之前给大家分享了一篇调用最新文章、调用热门文章的wordpress教程,今天再分享一篇调用指定分类文章的方法的wordpress教程文章。
也是非常基础的wordpress教程,下面直接贴出代码
<?php query_posts('cat=1&showposts=5'); //cat是要调用的分类ID,showposts是需要显示的文章数量 ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ><?php the_title(); ?></a>
<?php endwhile; wp_reset_query(); ?>