WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/23/2008 04:08:47 PM (13 years ago)
Author:
ryan
Message:

Comment paging and sorting from Viper007Bond. see #7927

File:
1 edited

Legend:

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

    r9274 r9296  
    11361136 * @return string
    11371137 */
    1138 function get_comments_pagenum_link($pagenum = 1) {
     1138function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) {
    11391139    global $wp_rewrite;
    11401140
     
    11521152    $base = trailingslashit( get_bloginfo( 'home' ) );
    11531153
    1154     if ( $pagenum > 1 ) {
     1154    $result = $base . $request;
     1155   
     1156    if ( 'newest' == get_option('default_comments_page') ) {
     1157        if ( $pagenum != $max_page )
     1158            $result = add_query_arg( 'cpage', $pagenum, $base . $request );
     1159    } elseif ( $pagenum > 1 )
    11551160        $result = add_query_arg( 'cpage', $pagenum, $base . $request );
    1156     } else {
    1157         $result = $base . $request;
    1158     }
    11591161
    11601162    $result .= '#comments';
     
    11951197        $label = __('» Newer Comments');
    11961198
    1197     echo '<a href="' . clean_url(get_comments_pagenum_link($nextpage));
     1199    echo '<a href="' . clean_url( get_comments_pagenum_link( $nextpage, $max_page ) );
    11981200    $attr = apply_filters( 'next_comments_link_attributes', '' );
    11991201    echo "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
Note: See TracChangeset for help on using the changeset viewer.