I know this is 4-5yrs old …
I’m having similar issues. I have the typical repeater (title, image, link) that I would like to randomize. All of my images are showing up all at once. Could someone please help me roll this row randomization into my existing code below?
<?php if( have_rows('billboard') ): ?> <?php while( have_rows('billboard') ): the_row(); // vars $image = get_sub_field('image'); $link = get_sub_field('link'); ?> <?php if( $link ): ?> <a href="<?php echo $link; ?>"> <?php endif; ?> <img class="billboard" src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt'] ?>" /> <?php if( $link ): ?> </a> <?php endif; ?> <?php endwhile; ?> <?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!
© 2022 Advanced Custom Fields.