wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



paginate_comments_links › WordPress Function

Desde2.7.0
Obsoleton/a
› paginate_comments_links ( $args = array() )
Parâmetros:
  • (string|array) $args Optional args. See paginate_links(). Default empty array.
    Required: No
    Padrão: array()
Ver:
Retorna:
  • (string|string[]|null|void) Markup for comment page links, or an array of them when
    the 'type' argument is 'array'. Null if the query is not for
    an existing single post of any post type. Nothing when 'echo'
    is true and 'type' is not 'array'.
Definido em:
Codex:

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



Fonte

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;
	}
}