如何只包括一个类别

时间:2015-12-07 23:43:28

标签: wordpress blogs posts

客户端的wordpress是相当自定义的,并且已经有很多东西被毁坏了,只有真正可以使用的功能。知道如何定制这个:

<?php the_widget( 'WP_Widget_Recent_Posts' ); ?>

只显示某个类别?

1 个答案:

答案 0 :(得分:0)

&#13;
&#13;
<?php
$catquery = new WP_Query( 'cat=1&posts_per_page=10' );
while($catquery->have_posts()) : $catquery->the_post();
?>
<ul>
<li><h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3></li>
</ul>
<?php endwhile; ?>
&#13;
&#13;
&#13;