Home › Forums › Front-end Issues › Loop through all possible choices dropdown › Reply To: Loop through all possible choices dropdown
To anyone else looking for the solution I was able to execute this by using the following code:
// must add field key of the field you want
$field_key = "field_52a087a80a4c6";
$field = get_field_object($field_key);
if( $field )
{
echo '<div class="acf-task-difficulty-values">';
foreach( $field['choices'] as $k => $v )
{
echo '<a data-filter=.'.$k.' onclick="return false;">' . $v . '</a>';
}
echo '</div>';
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.