Make WordPress Core


Ignore:
Timestamp:
12/22/2008 07:33:50 PM (17 years ago)
Author:
ryan
Message:

get_previous_comments_link() and get_next_comments_link(). Props Viper007Bond. fixes #8058 for 2.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.7/wp-includes/link-template.php

    r10214 r10240  
    12461246
    12471247/**
    1248  * Display link to next comments pages.
    1249  *
    1250  * @since 2.7.0
     1248 * Return the link to next comments pages.
     1249 *
     1250 * @since 2.7.1
    12511251 *
    12521252 * @param string $label Optional. Label for link text.
    12531253 * @param int $max_page Optional. Max page.
    1254  */
    1255 function next_comments_link($label='', $max_page = 0) {
     1254 * @return string|null
     1255 */
     1256function get_next_comments_link( $label = '', $max_page = 0 ) {
    12561257    global $wp_query;
    12571258
     
    12781279        $label = __('Newer Comments »');
    12791280
    1280     echo '<a href="' . clean_url( get_comments_pagenum_link( $nextpage, $max_page ) );
    1281     $attr = apply_filters( 'next_comments_link_attributes', '' );
    1282     echo "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
    1283 }
    1284 
    1285 /**
    1286  * Display the previous comments page link.
     1281    return '<a href="' . clean_url( get_comments_pagenum_link( $nextpage, $max_page ) ) . '" ' . apply_filters( 'next_comments_link_attributes', '' ) . '>'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
     1282}
     1283
     1284/**
     1285 * Display the link to next comments pages.
    12871286 *
    12881287 * @since 2.7.0
    12891288 *
     1289 * @param string $label Optional. Label for link text.
     1290 * @param int $max_page Optional. Max page.
     1291 */
     1292function next_comments_link( $label = '', $max_page = 0 ) {
     1293    echo get_next_comments_link( $label, $max_page );
     1294}
     1295
     1296/**
     1297 * Return the previous comments page link.
     1298 *
     1299 * @since 2.7.1
     1300 *
    12901301 * @param string $label Optional. Label for comments link text.
    1291  */
    1292 function previous_comments_link($label='') {
    1293 
     1302 * @return string|null
     1303 */
     1304function get_previous_comments_link( $label = '' ) {
    12941305    if ( !is_singular() )
    12951306        return;
     
    13081319        $label = __('&laquo; Older Comments');
    13091320
    1310     echo '<a href="' . clean_url(get_comments_pagenum_link($prevpage));
    1311     $attr = apply_filters( 'previous_comments_link_attributes', '' );
    1312     echo "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
     1321    return '<a href="' . clean_url( get_comments_pagenum_link( $prevpage ) ) . '" ' . apply_filters( 'previous_comments_link_attributes', '' ) . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
     1322}
     1323
     1324/**
     1325 * Display the previous comments page link.
     1326 *
     1327 * @since 2.7.0
     1328 *
     1329 * @param string $label Optional. Label for comments link text.
     1330 */
     1331function previous_comments_link( $label = '' ) {
     1332    echo get_previous_comments_link( $label );
    13131333}
    13141334
Note: See TracChangeset for help on using the changeset viewer.