Support

Account

Home Forums Front-end Issues How to get Choices as an array?

Unread

How to get Choices as an array?

  • Hi,
    I want to create a loop that generates a menu from the choices in an label group.

    In short I have some items in a custom post type where ACF lets me assign the items into collections. I want to make these collections into buttons/selection. (I know how to do this once I have the items in an array!).

    I have done this with taxonomies for the cpt by simply using get_terms(tax_slug), but I would like to have the better interface of using ACF checkboxes.

    So I have a field group. I have a label with checkboxes for choices and the option to add further choices enabled. I have tried the have_rows() but it does not seem to pick up on my field group name.

    if( have_rows('field group name') ):
       
        while( have_rows('field group name') ): the_row();
      
        $fieldcollectionname = get_sub_field('choices'); //will be replaced by menu loop
        endwhile;
    endif;

    I have a feeling that the answer is right in front of my nose…
    Pls help

    Thank you in advance.
    Claus

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.