Hello,
I’m trying to display the row number of a repeater field, so it readers similar to a slide count (ie. 1 of 7 for row 1 of 7 rows). Thanks!
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; ?>
This was solved by ACF Support. Here is the code if anyone is interested:
<?php
$rows = get_field('blog_style_gallery');
$row_count = count($rows);
$i=1;
?>
<?php
echo "Slide: ". $i." of ".$row_count." Rows";
$i++;
?>