Support

Account

Home Forums Add-ons Repeater Field Random Repeater by SubField value Reply To: Random Repeater by SubField value

  • I’ve solved the issue with the following, if there is a more efficient method let me know!

    <?php
    
    $lists = get_field( 'testimonials' );
    shuffle($lists);
    if( $lists ){
    
        $i=0;
    	foreach( $lists as $list ){
    		if( $list['site-wide_display'] &&  $i < 1){
    		    echo $list['testimonial'];
    			echo $list['testimonial_name'];
    			$i +=1;
    		}
    		
    		
    	}
    }
    
    ?>