diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index dcd1cad2c9..d11327f2aa 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -1245,14 +1245,15 @@ function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) { } /** - * Display link to next comments pages. + * Return the link to next comments pages. * - * @since 2.7.0 + * @since 2.7.1 * * @param string $label Optional. Label for link text. * @param int $max_page Optional. Max page. + * @return string|null */ -function next_comments_link($label='', $max_page = 0) { +function get_next_comments_link( $label = '', $max_page = 0 ) { global $wp_query; if ( !is_singular() ) @@ -1277,20 +1278,30 @@ function next_comments_link($label='', $max_page = 0) { if ( empty($label) ) $label = __('Newer Comments »'); - echo '". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .''; + return ''. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .''; } /** - * Display the previous comments page link. + * Display the link to next comments pages. * * @since 2.7.0 * - * @param string $label Optional. Label for comments link text. + * @param string $label Optional. Label for link text. + * @param int $max_page Optional. Max page. */ -function previous_comments_link($label='') { +function next_comments_link( $label = '', $max_page = 0 ) { + echo get_next_comments_link( $label, $max_page ); +} +/** + * Return the previous comments page link. + * + * @since 2.7.1 + * + * @param string $label Optional. Label for comments link text. + * @return string|null + */ +function get_previous_comments_link( $label = '' ) { if ( !is_singular() ) return; @@ -1307,9 +1318,18 @@ function previous_comments_link($label='') { if ( empty($label) ) $label = __('« Older Comments'); - echo '". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .''; + return '' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .''; +} + +/** + * Display the previous comments page link. + * + * @since 2.7.0 + * + * @param string $label Optional. Label for comments link text. + */ +function previous_comments_link( $label = '' ) { + echo get_previous_comments_link( $label ); } /**