Home Forums ACF PRO get_sub_field_object select labels Reply To: get_sub_field_object select labels

  • When I print_r($object) from the above example, nothing at all is displayed. It’s like the object doesn’t return anything. So the result is:


    However, I noticed I have another of these loops where get_sub_field_object function appears to beworking, but it’s not in the have rows function.

    if (get_sub_field('class_title') ) :
    $title_select = (get_sub_field_object('class_title'));
    $title_class = get_sub_field('class_title');
    $title = ($title_select['choices'][$title_class]);
    echo '<h2 class="' . $title_class . ' desktop"><a href="' . $title_class . '">' . $title . '</a></h2>';
    echo '<h2 class="' . $title_class . ' mobile">' . $title . '</h2>';

    This is displaying the correct values and labels. print_r(title_select); gives the full array.