get_previous_comments_link()
最后更新于:2021-11-26 23:11:36
get_previous_comments_link( string$label=”)Retrieves the link to the previous comments page.
参数
- $label
-
(string) (Optional) Label for comments link text.
Default value: ”
响应
(string|void) HTML-formatted link for the previous page of comments.
源文件
文件: gc-includes/link-template.php
function get_previous_comments_link( $label = '' ) {
if ( ! is_singular() ) {
return;
}
$page = get_query_var( 'cpage' );
if ( (int) $page <= 1 ) {
return;
}
$prevpage = (int) $page - 1;
if ( empty( $label ) ) {
$label = __( '« 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', '&$1', $label ) . '</a>';
}