WordPress at a glance

get_previous_comments_link() WP 1.0

Retrieves the link to the previous comments page.

✈ 1 time = 0.00019s = fast | 50000 times = 2.7s = fast
Hooks from function:
Return

String/null. HTML-formatted link for the previous page of comments.

Usage

get_previous_comments_link( $label );
$label(string)
Label for comments link text.
Default: ''

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

<?php
function get_previous_comments_link( $label = '' ) {
	if ( ! is_singular() )
		return;

	$page = get_query_var('cpage');

	if ( intval($page) <= 1 )
		return;

	$prevpage = intval($page) - 1;

	if ( empty($label) )
		$label = __('&laquo; Older Comments');

	/**
	 * Filters the anchor tag attributes for the previous comments page link.
	 *
	 * @since 2.7.0
	 *
	 * @param string $attributes Attributes for the anchor tag.
	 */
	return '<a href="' . esc_url( get_comments_pagenum_link( $prevpage ) ) . '" ' . apply_filters( 'previous_comments_link_attributes', '' ) . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) .'</a>';
}

Related Functions

From tag: Link (tag A in HTML)

More from tag: Comments pagination (navigation)

More from category: Comments

No comments
    Hello, !     Log In . Register