Last active
June 16, 2017 05:33
-
-
Save cliffordp/7b1d298baf55121ec3a54e63b5f8b009 to your computer and use it in GitHub Desktop.
Image Widget Plus - Randomize order of all Slideshows
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 | |
/** | |
* Image Widget Plus - Randomize order of all Slideshows | |
* | |
* From https://gist.github.com/cliffordp/7b1d298baf55121ec3a54e63b5f8b009 | |
* For https://theeventscalendar.com/support/forums/topic/image-widget-pro-slideshow-and-random/ | |
* | |
* @link https://theeventscalendar.com/product/wordpress-image-widget-plus/ | |
* | |
* @see Tribe__Image__Plus__Widget::widget() | |
*/ | |
add_filter( 'tribe_image_plus_widget_instance', 'cliff_image_widget_plus_randomize_slideshow' ); | |
function cliff_image_widget_plus_randomize_slideshow( $instance ) { | |
// only if we are in a Slideshow type of IW+ widget | |
if ( 'slideshow' === $instance['display'] ) { | |
shuffle( $instance['attachments'] ); | |
} | |
return $instance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment