Support

Account

Home Forums Add-ons Repeater Field Display Repeater Row Number (ie. 1 of 7) Reply To: Display Repeater Row Number (ie. 1 of 7)

  • Would probably include something like this in your loop:

    
    <?php if( have_rows('repeater_field_name') ): ?>
      <?php 
      $slides = get_field('repeater_field_name'); 
      $total_slides = count($slides);
      $current_slide = 1;
      ?>
    
      <ul class="slides">
        <?php while( have_rows('repeater_field_name') ): the_row(); ?>
    
          <li class="slide">
            <?php $image = get_sub_field('image'); ?>
            <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt'] ?>" />
            <span class="count"><?php echo $current_slide++; ?> of <?php echo $total_slides; ?></span>
          </li>
    
        <?php endwhile; ?>
    
      </ul>
    <?php endif; ?>