Created
August 27, 2019 18:56
-
-
Save robincornett/3436f6ca1a7b2272018ebdb45b0e2388 to your computer and use it in GitHub Desktop.
Sample function to change the banner featured image output in Display Featured Image for Genesis to a slideshow. This example is not applied conditionally, so would change the output sitewide. It starts with four image IDs and adds them to the slider output as URLs (required).
This file contains 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 | |
add_filter( 'display_featured_image_genesis_backstretch_variables', 'rgc_test_slider_filter' ); | |
/** | |
* Change the banner featured image to be a slidehow sitewide. | |
* | |
* @param array $variables | |
* @return array | |
*/ | |
function rgc_test_slider_filter( $variables ) { | |
$image_ids = array( 2023, 2053, 2150, 1947 ); | |
foreach ( $image_ids as $id ) { | |
$variables['slider'][] = wp_get_attachment_image_url( $id, 'displayfeaturedimage_backstretch', false ); | |
} | |
$variables['duration'] = 3000; // this is the default duration value in milliseconds. | |
return $variables; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment