Created
June 9, 2017 05:26
-
-
Save bmoredrew/05112103978b526dd307324c982982d9 to your computer and use it in GitHub Desktop.
Randomly display 3 ACF repeater rows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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