WordPress调用指定数量最新发布文章

作者: 站长 上传时间: 浏览: N/A 下载: N/A 格式: N/A 评分: N/A

今天在群里有个朋友问在Wordpress博客怎么控制文章数量,因为在博客后台的文章数量是会关联分页数量的,所以希望能独立设置最新文章的文章数量。

调用指定数量文章的方法其实很简单,就是在文章循环的地方加入一个showposts=10,10就是调用的文章条数,下面悟空搜写一个例子,大家自行摸索。

<?php query_posts("showposts=10&orderby=date&order=DESC")?>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a><span><?php the_time('m-d'); ?></span></li>
<?php endwhile; ?>
                                                          
                        

Leave a Comment