WordPress全站最新文章的调用代码:
<h2>Recent Posts</h2> <ul> <?php get_archives('postbypost', 6); ?> </ul>
WordPress指定栏目最新文章的调用代码:
<ul> <?php $recent = new WP_Query("cat=1&showposts=10"); while($recent->have_posts()) : $recent->the_post();?> <li><a href="<?php the_permalink() ?>" rel="bookmark"> <?php the_title(); ?> </a></li> <?php endwhile; ?> </ul>
注:代码中cat=1表示从栏目1中进行调用,showposts=10则是调用该栏目前10条记录,你可以将这段代码加入到任何你需要显示该记录的模板文件中。