wpseek.com
WordPress开发者和主题制作者的搜索引擎
paginate_comments_links › WordPress Function
Since2.7.0
已弃用n/a
› paginate_comments_links ( $args = array() )
| 参数: |
|
| 查看: | |
| 返回: |
|
| 定义在: |
|
| 文档: |
Displays or retrieves pagination links for the comments on the current post.
Related Functions: get_comments_link, next_comments_link, get_comment_link, paginate_links, comments_link
源码
function paginate_comments_links( $args = array() ) {
global $wp_rewrite;
if ( ! is_singular() ) {
return null;
}
$page = get_query_var( 'cpage' );
if ( ! $page ) {
$page = 1;
}
$max_page = get_comment_pages_count();
$defaults = array(
'base' => add_query_arg( 'cpage', '%#%' ),
'format' => '',
'total' => $max_page,
'current' => $page,
'echo' => true,
'type' => 'plain',
'add_fragment' => '#comments',
);
if ( $wp_rewrite->using_permalinks() ) {
$defaults['base'] = user_trailingslashit( trailingslashit( get_permalink() ) . $wp_rewrite->comments_pagination_base . '-%#%', 'commentpaged' );
}
$args = wp_parse_args( $args, $defaults );
$page_links = paginate_links( $args );
if ( $args['echo'] && 'array' !== $args['type'] ) {
echo $page_links;
} else {
return $page_links;
}
}