Home Forums Add-ons Repeater Field Randomizing Repeater Rows Reply To: Randomizing Repeater Rows

  • primary it should work with help of php function shuffle.
    but you need to rebuild your code and replace the while loop with a foreach loop to use it.

    here is a simple code how to use randomize(shuffle):

    $rows = get_field('repeater_field_name' ); //get all rows
    shuffle ($rows); //randomize rows
    if($rows) {
    	foreach($rows as $row) { //print rows
    		echo $row['sub_field_name'];
    		echo ' ';
    		echo $row['sub_field2_name'];
    		echo '<br>';