Support

Account

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>';
            }