paginate_comments_links

Advertisement

Summery Summery

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

Syntax Syntax

paginate_comments_links( string|array $args = array() )

Parameters Parameters

$args

(Optional) args. See paginate_links().

Default value: array()

Return Return

(void|string|array) Void if 'echo' argument is true and 'type' is not an array, or if the query is not for an existing single post of any post type. Otherwise, markup for comment page links or array of comment page links, depending on 'type' argument.

Source Source

File: wp-includes/link-template.php

 * Displays or retrieves pagination links for the comments on the current post.
 *
 * @see paginate_links()
 * @since 2.7.0
 *
 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
 *
 * @param string|array $args Optional args. See paginate_links(). Default empty array.
 * @return void|string|array Void if 'echo' argument is true and 'type' is not an array,
 *                           or if the query is not for an existing single post of any post type.
 *                           Otherwise, markup for comment page links or array of comment page links,
 *                           depending on 'type' argument.
 */
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,
		'type'         => 'plain',
		'add_fragment' => '#comments',
	);

Advertisement

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.

See also See also

Advertisement

Leave a Reply