WordPress 循环获取指定分类目录文章列表

来自:互联网
时间:2020-03-25
阅读:

开发WordPress网站就靠它了

<?php query_posts('cat=20&posts_per_page=4'); while(have_posts()): the_post(); ?>   
   <li><a href="<?php the_permalink(); ?>" target="_blank"><?php the_title();?></a></li>   
<?php endwhile; wp_reset_query(); ?>

其中cat=20代表分类ID,posts_per_page=4代表显示几条记录。

返回顶部
顶部