Support

Account

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.