Home › Forums › ACF PRO › get_sub_field_object select labels › Reply To: get_sub_field_object select labels
Hi Elliot, sorry i mixed around my responses and was providing a non-specific example. With regards to the field group code, here is the code i’m using for this:
if (have_rows('class_menu') ) : ?>
<ul class="class-menu">
<?php while(have_rows('class_menu') ): the_row();
$class_select = (get_sub_field_object('menu_class'));
$class = get_sub_field('menu_class');
$label = ($class_select['choices'][$class]);
$link = get_sub_field('menu_link'); ?>
<li class="<?php echo $class; ?>"><a href="<?php echo $link; ?>"><?php echo $label; ?></a></li>
<?php endwhile; ?>
</ul>
It might get a little confusing, but this works when reverted back to 4.3.8 – is it possible that the database upgrade didn’t work properly? I’m working on a localhost if that helps.
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.