Home › Forums › Add-ons › Repeater Field › Loop Repeater Based on Sub Field Values › Reply To: Loop Repeater Based on Sub Field Values
@chriswhiteley, the code posted by @bloodlvst should do what you want. Just change the field_name
to the name of your repeater field and sub_field
with your sub field name.
and it will show every row with a value of functional assay
if you want to only show the first one add a break;
after the line the_sub_field('subfield');
There is one error in the code
<?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;
?>
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.