脚本宝典收集整理的这篇文章主要介绍了php – WordPress循环中的随机顺序?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
<?PHP // Start the Loop. while ( have_posts() ) : the_post(); /* * Include the post format-sPEcific template for the content. If you want to * use this in a child theme,then include a file called called content-___.PHP * (where ___ is the post format) and that will be used instead. */ array ( 'orderby' => 'RAND' ); get_template_part( 'content',get_post_format() ); endwhile; // PrevIoUs/next page navigation. twentyfourteen_paging_nav(); else : // If no content,include the "No posts found" template. get_template_part( 'content','none' ); endif; ?>
<?PHP $query = new WP_Query( array ( 'orderby' => 'rand','posts_per_page' => '-1' ) ); if( $query->have_posts() ): // Start the Loop. while ( $query->have_posts() ) : $query->the_post(); /* * Include the post format-specific template for the content. If you want to * use this in a child theme,then include a file called called content-___.PHP * (where ___ is the post format) and that will be used instead. */ get_template_part( 'content','none' ); endif; ?>
以上是脚本宝典为你收集整理的php – WordPress循环中的随机顺序?全部内容,希望文章能够帮你解决php – WordPress循环中的随机顺序?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。