WordPress模板标签next_posts_link用于在分类、标签、日期等归档页输出下一页链接,需要注意是用在The Loop主循环之外。
next_posts_link( string $label = null, integer $max_page = 0 )
函数参数
$label
字符串值,默认值:null
链接的锚文本,默认输出 下一页 »
$max_pages
整数型,默认值:0
限制最多翻页数,如果设置为2,那么翻到第2页就不再出现“下一页”链接,默认不限制。
函数使用示例
<?php while ( have_posts() ) : the_post(); the_title(); endif; next_posts_link(); ?>
扩展阅读
next_posts_link()函数位于:wp-includes/link-template.php
相关函数:
- posts_nav_link()
- previous_posts_link()
- get_next_posts_link()
- get_previous_posts_link()
- paginate_links()