get_comments_pagenum_link( int $pagenum = 1, int $max_page )
Retrieves the comments page number link.
描述
参数
- $pagenum
-
(int)
(Optional)
Page number.Default value: 1
- $max_page
-
(int)
(Optional)
The maximum number of comment pages. Default 0.
返回值
(string) The comments page number link URL.
源代码
File: wp-includes/link-template.php
function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) {
global $wp_rewrite;
$pagenum = (int) $pagenum;
$result = get_permalink();
if ( 'newest' == get_option('default_comments_page') ) {
if ( $pagenum != $max_page ) {
if ( $wp_rewrite->using_permalinks() )
$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
else
$result = add_query_arg( 'cpage', $pagenum, $result );
}
} elseif ( $pagenum > 1 ) {
if ( $wp_rewrite->using_permalinks() )
$result = user_trailingslashit( trailingslashit($result) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged');
else
$result = add_query_arg( 'cpage', $pagenum, $result );
}
$result .= '#comments';
/**
* Filters the comments page number link for the current request.
*
* @since 2.7.0
*
* @param string $result The comments page number link.
*/
return apply_filters( 'get_comments_pagenum_link', $result );
}
更新日志
Version | 描述 |
---|---|
2.7.0 | Introduced. |
相关函数
Uses
-
wp-includes/formatting.php:
trailingslashit() -
wp-includes/functions.php:
add_query_arg() -
wp-includes/link-template.php:
get_comments_pagenum_link -
wp-includes/link-template.php:
get_permalink() -
wp-includes/link-template.php:
user_trailingslashit() -
wp-includes/plugin.php:
apply_filters() -
wp-includes/option.php:
get_option() -
wp-includes/class-wp-rewrite.php:
WP_Rewrite::using_permalinks()
Show 3 more uses
Used By
-
wp-includes/link-template.php:
wp_get_canonical_url() -
wp-includes/link-template.php:
get_next_comments_link() -
wp-includes/link-template.php:
get_previous_comments_link()
你可能对这些文章感兴趣:
- wordpress函数get_the_title()用法示例
- wordpress函数get_the_posts_navigation()用法示例
- wordpress函数get_the_terms()用法示例
- wordpress函数get_the_tags()用法示例
- wordpress函数get_the_taxonomies()用法示例
- wordpress函数get_the_permalink()用法示例
- wordpress函数get_the_password_form()用法示例
- wordpress函数get_the_posts_pagination()用法示例
- wordpress函数get_the_modified_date()用法示例
- wordpress函数get_the_modified_time()用法示例
- wordpress函数get_the_modified_author()用法示例
- wordpress函数get_the_guid()用法示例
- wordpress函数get_the_ID()用法示例
- wordpress函数get_the_excerpt()用法示例
如有疑问,请前往问答中心反馈!
反馈