Home › Forums › Add-ons › Repeater Field › Count Repeater Items › Reply To: Count Repeater Items
To others who have troubles with repeater fields in flexible content
<?php //Flexible content
if( have_rows('builder') ) :
while ( have_rows('builder') ) : the_row();
if( get_row_layout() == 'shortcuts' ):
//Have to make the count before "have_rows"
//else it will return false
$count = count( get_sub_field('buttons') );
//Repeater field
if( have_rows('buttons') ) :
while ( have_rows('buttons') ) : the_row();
endwhile;
endif;
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.