Support

Account

Home Forums Add-ons Repeater Field Loop Repeater Based on Sub Field Values Reply To: Loop Repeater Based on Sub Field Values

  • Hey Chris, try this out:

    <?php
    if(have_rows('field_name')):
       while(have_rows('field_name')): the_row();
          if(get_sub_field('sub_field') == 'functional assay'):
             the_sub_field('sub_field');
          endif;
       endwhile;
    endif;
    ?>

    Thanks John for the correction, I’ve edited. Dunno how I missed that one *whoosh*

    The only problem is if you have more than one of the same repeater subfield in a single post it doesn’t display the next one. My PHP knowledge is somewhat novice though so maybe another person can fix that! But this should nudge you in the right direction hopefully.