篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Image Widget Plus - 随机化所有幻灯片的顺序相关的知识,希望对你有一定的参考价值。
<?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;
}
以上是关于php Image Widget Plus - 随机化所有幻灯片的顺序的主要内容,如果未能解决你的问题,请参考以下文章