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.
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.