I'm currently adding ACF fields into my Owl Carousel. While getting the images to display works. I'm having an issue where my code spits out all of the results from it's repeater into each slide, rather than one by one. Below is the code (everything is linked correctly to the Wordpress ACF fields) and I've attached an image of how the slider looks.
Any suggestions on how I can fix this?
<div class="owl-carousel" id="owl-single-example">
<?php foreach ($homepage_slideshow_gallery as $homepage_slideshow_gallery):?>
<div class="slide" style="background-image: url('<?php echo $homepage_slideshow_gallery['url']; ?>')" />
<div class="container caption">
<?php if( have_rows('homepage_slideshow_repeater') ): ?>
<?php while( have_rows('homepage_slideshow_repeater') ): the_row(); ?>
<p><?php the_sub_field('homepage_slideshow_repeater_company'); ?></p>
<h1 class="textblock"><span><?php the_sub_field('homepage_slideshow_repeater_title'); ?></h1>
<a class="btn" href="<?php the_sub_field('homepage_slideshow_repeater_url'); ?>">View Work</a>
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>
<?php endforeach;?>
get_field('homepage_slideshow_gallery');
and the repeater $homepage_slideshow_repeater isget_field('homepage_slideshow_gallery');
, so they are separate ACF fields! – Charlie McShane