I’ve been following the thread at https://generatepress.com/forums/topic/variable-random-background-image-page-headers/page/2/ and implemented the final version of the solution Tom presented. Here’s the snippet I’m running:
add_filter( 'generate_page_header_options', function( $options ) {
if ( is_front_page() ) {
$ids = array(
'247',
'246',
'22873'
);
$id = $ids[array_rand($ids)];
$options['image_id'] = $id;
}
return $options;
} );
Unfortunately, it isn’t having any impact on the image display: http://morikamidev.wpengine.com/
This is a WPE hosted install and I do have Allow ORDER BY RAND() enabled. If I’m following the previous thread, I’m not entirely sure if that snippet is designed to pull a random header element or just random images for a single element (I’m after the latter).
Do you see any obvi errors in the snippet or is there a better approach?