WordPress at a glance

paginate_comments_links() WP 1.0

Displays or retrieves pagination links for the comments on the current post.

  • See: paginate_links()
  • Global. WP_Rewrite. $wp_rewrite
Works based on: paginate_links()

No Hooks.

Return

String/null. Markup for pagination links.

Usage

paginate_comments_links( $args );
$args(string/array)
Optional args. See paginate_links().
Default: empty array

Code of paginate_comments_links: wp-includes/link-template.php VER 4.9.8

<?php
function paginate_comments_links( $args = array() ) {
	global $wp_rewrite;

	if ( ! is_singular() )
		return;

	$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,
		'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'] )
		echo $page_links;
	else
		return $page_links;
}

Related Functions

From tag: Comments pagination (navigation)

More from category: Comments

No comments
    Hello, !     Log In . Register