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 | |
// Get the repeater field | |
$repeater = get_field( 'repeater_field_name' ); | |
// Get a random rows. Change the second parameter in array_rand() to how many rows you want. | |
$random_rows = array_rand( $repeater, 2 ); | |
// Loop through the random rows if more than one is returned | |
if( is_array( $random_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 | |
function update_value( $post_id, $field, $value ){ | |
// Check to see if there are any old relationships | |
if( parent::get_value( $post_id, $field ) !== '' ){ | |
// If so, find out what needs to be added or deleted | |
$old_value = explode( ',', parent::get_value( $post_id, $field ) ); | |
$new_value = explode( ',', $value ); |
NewerOlder