Not an issue but just some code to alternate two feature images at random on page load.
Use this within the loop:
<?php
// Get a random number
$min = 1;
$max = 10;
$num = rand($min,$max);
// If it is an odd number and we have a feature image
if ( $num & 1 && has_post_thumbnail() ) {
the_post_thumbnail();
} elseif ( $num % 2 == 0 && MultiPostThumbnails::has_post_thumbnail( get_post_type(), 'secondary-image', NULL) ) {
// If it is an even number and we have a secondary image
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image', NULL, ''); // add your thumbnail size as the last argument
} else { // It's even and we don't have a second feature image so get the default feature image
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
}
?>
Not an issue but just some code to alternate two feature images at random on page load.
Use this within the loop: