wordpress - Random Repeater in a Repeater Advanced Custom Fields -


i'm using advanced custom fields , have repeater in repeater. need nested repeater pull 1 row randomly. here have isn't working:

<?php $i = 0; while(the_repeater_field('squares')): ++$i;         $repeater = get_sub_field( 'images' );         $rand = rand(0, (count($repeater) - 1));?>         <a href="<?php the_sub_field('link'); ?>" class="fs-square" style="background-image:url('<?php echo $rand['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; ?> 

basically, have repeater squares , in have repeater images. need images repeater random.

you may wanna try

<?php echo $repeater[$rand]['four-square']; ?> 

instead of

<?php echo $rand['four-square']; ?> 

hth!


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -