get_next_posts_link()
get_next_posts_link( string $label = null, int $max_pag…
get_next_posts_link( string $label = null, int $max_page )
检索下一个帖子页面链接。
Retrieves the next posts page link.
检索下一个帖子页面链接。
Retrieves the next posts page link.
目录锚点:#参数#返回#源码#笔记
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $label | (string) | 可选 | 链接文本的内容。 |
| $max_page | (int) | 可选 | 最多页数。默认值0。 |
返回(Return)
(string|void)HTML格式的下一篇文章页面链接。
源码(Source)
/**
* Return the next posts page link.
*
* @since 2.7.0
*
* @global int $paged
* @global WP_Query $wp_query
*
* @param string $label Content for link text.
* @param int $max_page Optional. Max pages.
* @return string|void HTML-formatted next posts page link.
*/
function get_next_posts_link( $label = null, $max_page = 0 ) {
global $paged, $wp_query;
if ( !$max_page )
$max_page = $wp_query->max_num_pages;
if ( !$paged )
$paged = 1;
$nextpage = intval($paged) + 1;
if ( null === $label )
$label = __( 'Next Page »' );
if ( !is_single() && ( $nextpage <= $max_page="" )="" )="" {="" *="" *="" filter="" the="" anchor="" tag="" attributes="" for="" the="" next="" posts="" page="" link.="" *="" *="" @since="" 2.7.0="" *="" *="" @param="" string="" $attributes="" attributes="" for="" the="" anchor="" tag.="" */="" $attr="apply_filters(" 'next_posts_link_attributes',="" ''="" );="" return="">" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&$1', $label) . '';
}
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.7.0 | wp-includes/link-template.php:2357 | 3 | 5 |
笔记(Notes)
默认用法
自定义标签
自定义标签和自定义页数
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!