Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Randomly display 3 ACF repeater rows
<?php
$blocks = get_field('menu_blocks');
if( $blocks ) $count = 0;
{
shuffle( $blocks );
foreach( $blocks as $block )
{
if( $count==3 ) break;
$title = $block['menu_block_title'];
echo '<p>' . $title . '</p>';
$count++;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment