Hi all,
I am using the have_rows() call twice on the page, one to create a slider and the other to show images. I have added breaks into this to ensure all rows are not shown.
The issue I have is that if the first slider using the have_rows() call shows 4 and then breaks, the next image gallery using have_rows() starts from row 5, whereas I want it to reset and start from row 1.
The code for the first slider.
<?php if( have_rows('slides') ): ?>
<ul class="slides">
<?php
$headercount = 1;
while( have_rows('slides') ): the_row();
$image = get_sub_field('image');
?>
<li>
<?php echo wp_get_attachment_image( $image, 'full' ); ?>
<p><?php the_sub_field('caption'); ?></p>
</li>
<?php
$headercount++;
if ($headercount == 4) { break; }
endwhile; ?>
</ul>
<?php endif; ?>
What am I missing to reset this so the next call for the rows is from row 1 again?
add reset_rows();
after the first loop.