When your website means business.

ACF | Type: PHPACF Random Image Repeater

Example shows creating random background image for header.

<?php 
  //must select ImageID as Return Value
	$rows = get_field('title_images' ); // get all the rows
	$rand_row = array_rand($rows, 1); // get a random row
	$rand_row_image = $rand_row['img_title']; // get the sub field value 

	$titleimage = wp_get_attachment_image_src( $rand_row_image, 'full' );
	// url = $image[0];
	// width = $image[1];
	// height = $image[2];
?>

 

Reference Links

Menu
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Cookies Notice