Home › Forums › Add-ons › Repeater Field › Count rows in nested repeater before loop › Reply To: Count rows in nested repeater before loop
Hi John, thanks for your reply!
By before the loop, I mean before while(have_rows())
. This is my current setup; looking to insert my count as in double brackets:
<?php if( get_row_layout() == 'flex_field' ):
if( have_rows('repeater') ): ?>
<div class="repeater-wrapper [[ECHO REPEATER ROW COUNT HERE]]">
<?php while ( have_rows('repeater') ) : the_row(); ?>
<div class="repeater-row">
<p><?php the_sub_field('repeater_row_content'); ?></p>
</div>
<?php endwhile; ?>
</div>
<?php endif;
endif; ?>
Apologies if my syntax is a bit messy. Any thoughts on how your solution might work in this instance?
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.