EDIT: 下面是正确的答案。。。
<!-- RECENT BLOG POSTS -->
<?php
$recentargs = array(
\'post_type\' => \'post\',
\'post_status\' => \'publish\',
\'category_name\' => \'social-grid\',
\'posts_per_page\' => $number_of_recent_posts,
\'orderby\' => \'post_date\',
\'order\' => \'DESC\'
);
$rec_arr_posts = new WP_Query( $recentargs );
if ( $rec_arr_posts->have_posts() ) :
while ( $rec_arr_posts->have_posts() ) :
$rec_arr_posts->the_post();
?>
<?php get_the_post_thumbnail_url(); ?>
<?php the_permalink(); ?>
<?php the_title(); ?>
<?php echo get_the_excerpt(); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_postdata(); ?>
<!-- END RECENT BLOG POSTS -->
<!-- RECENT EXCLUDED POSTS -->
<?php
$recenttoexcludeargs = array(
\'post_type\' => \'post\',
\'post_status\' => \'publish\',
\'category_name\' => \'social-grid\',
\'posts_per_page\' => $number_of_recent_posts,
\'orderby\' => \'post_date\',
\'order\' => \'DESC\'
);
$recent_to_exclude_arr_posts = new WP_Query( $recenttoexcludeargs );
if ( $recent_to_exclude_arr_posts->have_posts() ) {
$posts_ids = wp_list_pluck( $recent_to_exclude_arr_posts->posts, \'ID\' );
} ?>
<!-- END RECENT EXCLUDED POSTS -->
<!-- RANDOM BLOG POSTS -->
<?php
$randomargs = array(
\'post_type\' => \'post\',
\'post_status\' => \'publish\',
\'category_name\' => \'social-grid\',
\'posts_per_page\' => $number_of_random_posts,
\'post__not_in\' => $posts_ids,
\'orderby\' => \'rand\',
\'order\' => \'DESC\'
);
$rand_arr_posts = new WP_Query( $randomargs );
if ( $rand_arr_posts->have_posts() ) :
while ( $rand_arr_posts->have_posts() ) :
$rand_arr_posts->the_post();
?>
<?php get_the_post_thumbnail_url(); ?>
<?php the_permalink(); ?>
<?php the_title(); ?>
<?php echo get_the_excerpt(); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_postdata(); ?>
您需要设置变量$number\\u of\\u recent\\u posts&$\\u random\\u帖子的数量。
P、 你在哪里工作我来找你的工作c: