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; ?>
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.