wpseek.com
A WordPress-centric search engine for devs and theme authors
get_next_comments_link › WordPress Function
Since2.7.1
Deprecatedn/a
› get_next_comments_link ( $label = '', $max_page = 0, $page = null )
Parameters: (3) |
|
Returns: |
|
Defined at: |
|
Codex: | |
Change Log: |
|
Retrieves the link to the next comments page.
Related Functions: next_comments_link, get_edit_comment_link, get_comments_link, get_comment_link, get_next_posts_link
Source
function get_next_comments_link( $label = '', $max_page = 0, $page = null ) {
global $wp_query;
if ( ! is_singular() ) {
return;
}
if ( is_null( $page ) ) {
$page = get_query_var( 'cpage' );
}
if ( ! $page ) {
$page = 1;
}
$next_page = (int) $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 ( $next_page > $max_page ) {
return;
}
if ( empty( $label ) ) {
$label = __( 'Newer Comments »' );
}
/**
* Filters the anchor tag attributes for the next comments page link.
*
* @since 2.7.0
*
* @param string $attributes Attributes for the anchor tag.
*/
$attr = apply_filters( 'next_comments_link_attributes', '' );
return sprintf(
'<a href="%1$s" %2$s>%3$s</a>',
esc_url( get_comments_pagenum_link( $next_page, $max_page ) ),
$attr,
preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label )
);
}