Created
December 1, 2015 11:04
-
-
Save tjhole/d309b1ef6398273cb7bf to your computer and use it in GitHub Desktop.
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 | |
$rows = get_field('repeater_field_name' ); // get all the rows | |
$rand_row = $rows[ array_rand( $rows ) ]; // get a random row | |
$rand_row_image = $rand_row['sub_field_name' ]; // get the sub field value | |
// Note | |
// $first_row_image = 123 (image ID) | |
$image = wp_get_attachment_image_src( $rand_row_image, 'full' ); | |
// url = $image[0]; | |
// width = $image[1]; | |
// height = $image[2]; | |
?> | |
<img src="<?php echo $image[0]; ?>" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment