wordpress调用随机文章和随机推荐文章

wordpress调用随机文章的代码如下: <?php $query = array( 'post_type' => 'post', 'orderby' => 'rand' ); $posts = new WP_Query( $query ); if ( $posts->have_posts() ) { while( $posts->have_posts() ) : $posts->the_post(); the_content(); endwhile; } wp_reset_query(); ?> wordpress随机调用置顶推…