我正在使用while循环
while(have_posts()):the_post();
获取所有帖子并显示页面。如何随机化帖子。但问题是,在我正在处理的页面中,没有"查询"的迹象。此外,我还尝试使用一些提到的解决方案,但没有结果。
您可以通过以下方式更改query_posts($args)
的主查询:
// Alter the query
query_posts( 'orderby=RAND' );
while ( have_posts() ) : the_post();
// Do your stuff inside the loop
endwhile;
// Reset the query
wp_reset_query();