Support

Account

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?