【问题标题】:How To Include ONLY A Category如何仅包含一个类别
【发布时间】:2016-03-12 18:13:12
【问题描述】:

客户的 wordpress 是非常定制的,并且有大量内容被删除,只有功能可以真正使用。知道如何自定义这个:

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

只显示某个类别?

【问题讨论】:

标签: wordpress blogs posts


【解决方案1】:

<?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; ?>

【讨论】:

  • 不鼓励仅使用代码回答。解释你在做什么,以及为什么这可以解决这个问题......
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-03-18
  • 1970-01-01
  • 1970-01-01
  • 2013-03-03
  • 2019-05-14
  • 2016-02-12
  • 2020-11-05
相关资源
最近更新 更多