我试过了,但它仍然覆盖了例如
the_title(), get_post_meta($post->ID, \'key\', \'true\'), the_post_thumbnail(),
而且几乎所有的内容都被覆盖(我的意思是,当我使用相同的模板发表两篇文章时,字段、标题和图像都被覆盖。)我是这样做的:
<?php
$category_id = get_the_category( $post->ID ); $args =
array(\'posts_per_page\' => 1, \'category\' => $category_id); $announcements =
new WP_Query( $args );
while($announcements->have_posts()): $announcements->the_post();
?>
<div class="cover"><?php the_post_thumbnail(); ?></div>
<p><strong><span itemprop="title"><?php the_title();?></span></strong></p>
</div>
<?php endwhile;?>