Home › Forums › Add-ons › Repeater Field › Randomizing/Shuffling Repeater with Advanced Loop › Reply To: Randomizing/Shuffling Repeater with Advanced Loop
So should it be as simple as inserting it like this:
<?php if( have_rows('clients') ): ?>
<?php
function my_acf_load_value3( $value, $post_id, $field )
{
shuffle($value);
return $value;
}
add_filter('acf/load_value/name=clients', 'my_acf_load_value3', 10, 3);
?>
<div class="outerContainer clientGrid clearfix">
<?php while( have_rows('clients') ): the_row();
// vars
$name = get_sub_field('client_name');
$img = get_sub_field('logo');
$docVid = get_sub_field('doc_or_vid');
$docURL = get_sub_field('document_location');
$vidURL = get_sub_field('video_url');
?>
<div class="clientItem clearfix <?php the_sub_field('areas'); ?>">
<?php if($docURL && $docVid == 'doc'): ?>
<a target="_blank" class="clientLink" href="<?php echo $docURL; ?>">
<span class="sprite"></span>
</a>
<?php endif; ?>
<?php if($vidURL && $docVid == 'vid'): ?>
<a target="_blank" class="clientLink clientVid external" href="<?php echo $vidURL; ?>">
<span class="sprite"></span>
</a>
<?php endif; ?>
<?php if( $img ): ?>
<img class="client-logo" src="<?php echo $img; ?>" alt="<?php echo $name; ?>" />
<?php endif; ?>
</div>
<?php endwhile; ?>
</div><!-- ./clientGrid -->
<?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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.