Advertisements

get_next_comments_link

Definition:
function get_next_comments_link( $label = '', $max_page = 0 ) {}

Return the link to next comments page.

Parameters

  • string $label: Optional. Label for link text.
  • int $max_page: Optional. Max page.

Defined filters

  • next_comments_link_attributes
    apply_filters( 'next_comments_link_attributes', '' )

Source code

function get_next_comments_link( $label = '', $max_page = 0 ) {

	global $wp_query;



	if ( !is_singular() || !get_option('page_comments') )

		return;



	$page = get_query_var('cpage');



	$nextpage = intval($page) + 1;



	if ( empty($max_page) )

		$max_page = $wp_query->max_num_comment_pages;



	if ( empty($max_page) )

		$max_page = get_comment_pages_count();



	if ( $nextpage > $max_page )

		return;



	if ( empty($label) )

		$label = __('Newer Comments »');



	return '<a href="' . esc_url( get_comments_pagenum_link( $nextpage, $max_page ) ) . '" ' . apply_filters( 'next_comments_link_attributes', '' ) . '>'. preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&$1', $label) .'</a>';

}

1496

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: