Summery Summery
Retrieves the link to the next comments page.
Syntax Syntax
Parameters Parameters
- $label
-
(Optional) Label for link text.
Default value: ''
- $max_page
-
(Optional) Max page. Default 0.
Return Return
(string|void) HTML-formatted link for the next page of comments.
Source Source
File: wp-includes/link-template.php
}
/**
* Retrieves the link to the next comments page.
*
* @since 2.7.1
*
* @global WP_Query $wp_query WordPress Query object.
*
* @param string $label Optional. Label for link text. Default empty.
* @param int $max_page Optional. Max page. Default 0.
* @return string|void HTML-formatted link for the next page of comments.
*/
function get_next_comments_link( $label = '', $max_page = 0 ) {
global $wp_query;
if ( ! is_singular() ) {
return;
}
$page = get_query_var( 'cpage' );
if ( ! $page ) {
$page = 1;
}
$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;
}
Advertisement
Changelog Changelog
| Version | Description |
|---|---|
| 2.7.1 | Introduced. |