不确定您实际上是如何显示您的帖子的,无论它是一个自定义查询,还是您在哪个页面执行网格,例如类别页面。这里有一个小片段可能会对您有所帮助。
//get current category page
$category = get_the_category();
//get current category page ID
$category_id = $category->cat_ID;
//set arguments for your desired posts output
$args = array(
\'numberposts\' => 999,
\'offset\' => 0,
\'category\' => $category_id,
\'order\' => \'DESC\',
\'post_type\' => \'post\', //if your using a custom post type enter it here
\'post_status\' => \'publish\' );
$all_posts = get_posts($args);
//get amount of posts
$post_amount = count($all_posts);
//now we know the amount of posts you have in this category, we can do a conditional.
if($post_amount == 1){
//show all your content.
}
我还没有测试过这个,但我很确定逻辑是正确的。