您的位置:首页 > 其它

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

2015-03-13 14:59 369 查看
<?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代表显示几条记录

有用就点个赞吧!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: