Jonathan, thank you so much. I had to add a few more parameters but we got it there. Thanks again.
<?php
$i = 0;
while(have_rows('squares')):
the_row();
$i++;
$repeater = get_sub_field( 'images' );
$rand = rand(0, (count($repeater) - 1)); //does not select a specific row but rather just a number
?>
<a href="<?php the_sub_field('link'); ?>" class="fs-square" style="background-image:url('<?php echo $repeater[$rand]['image']['sizes']['four-square']; ?>')">
<div class="main-text"><?php the_sub_field('main_text'); ?></div>
<div class="icon-section">
<div class="icon"><?php the_sub_field('icon'); ?></div>
<div class="icon-text"><?php the_sub_field('icon_text'); ?></div>
</div>
</a>
<?php endwhile; ?>
Hey Jonathan, thanks for your help.
I tried your code and it sent the page into an infinite loop. Any other ideas?
I had a similar error but it was in the admin. I deactivated the WooDojo plugin and it fixed the problem so you may have to deactivate each plugin and retest to see if one is causing the error.
I had a similar error but it was in the admin. I deactivated the WooDojo plugin and it fixed the problem so you may have to deactivate each plugin and retest to see if one is causing the error.
I had a similar error but it was in the admin. I deactivated the WooDojo plugin and it fixed the problem so you may have to deactivate each plugin and retest to see if one is causing the error.
I had a similar error but it was in the admin. I deactivated the WooDojo plugin and it fixed the problem so you may have to deactivate each plugin and retest to see if one is causing the error.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.