Home › Forums › General Issues › Check repeater rows with value before loop › Reply To: Check repeater rows with value before loop
When I need to do this type of thing I use output buffering.
if (have_rows('repeater')) {
ob_start();
$display_row_count = 0;
while (have_rows('repeater')) {
the_row();
if (get_sub_field('true_false')) {
$display_row_count++;
// other code
}
} // end while have rows
$content = ob_get_clean();
if ($display_row_count >= 2) {
echo $content;
}
} // end if have rows
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.