WordPress.org

Make WordPress Core

Changeset 9318


Ignore:
Timestamp:
10/24/08 07:36:43 (6 years ago)
Author:
markjaquith
Message:

Enable pretty permalinks for previous_ and next_comments_link(). props DD32, Viper007Bond. see #7942

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/canonical.php

    r9300 r9318  
    150150                $paged_redirect['path'] = user_trailingslashit( trailingslashit( $paged_redirect['path'] ) . 'feed/' . ( ( 'rss2' ==  get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' ); 
    151151            } 
    152             if ( get_query_var('cpage') > 1 ) { 
     152            if ( ( 'newest' == get_option('default_comments_page') && get_query_var('cpage') > 0 ) || ( 'newest' != get_option('default_comments_page') && get_query_var('cpage') > 1 ) ) { 
    153153                $paged_redirect['path'] = user_trailingslashit( trailingslashit( $paged_redirect['path'] ) . 'comment-page-' . get_query_var('cpage'), 'commentpaged' ); 
    154154            } 
  • trunk/wp-includes/link-template.php

    r9300 r9318  
    11491149    $request = preg_replace('|^'. $home_root . '|', '', $request); 
    11501150    $request = preg_replace('|^/+|', '', $request); 
     1151    $request = preg_replace('|comment-page-[0-9]+/?$|', '', $request); 
    11511152 
    11521153    $base = trailingslashit( get_bloginfo( 'home' ) ); 
     
    11551156     
    11561157    if ( 'newest' == get_option('default_comments_page') ) { 
    1157         if ( $pagenum != $max_page ) 
     1158        if ( $pagenum != $max_page ) { 
     1159            if ( $wp_rewrite->using_permalinks() ) 
     1160                $result = user_trailingslashit( trailingslashit($base . $request) . 'comment-page-' . $pagenum, 'commentpaged'); 
     1161            else 
     1162                $result = add_query_arg( 'cpage', $pagenum, $base . $request ); 
     1163        } 
     1164    } elseif ( $pagenum > 1 ) { 
     1165        if ( $wp_rewrite->using_permalinks() ) 
     1166            $result = user_trailingslashit( trailingslashit($base . $request) . 'comment-page-' . $pagenum, 'commentpaged'); 
     1167        else 
    11581168            $result = add_query_arg( 'cpage', $pagenum, $base . $request ); 
    1159     } elseif ( $pagenum > 1 ) 
    1160         $result = add_query_arg( 'cpage', $pagenum, $base . $request ); 
     1169    } 
    11611170 
    11621171    $result .= '#comments'; 
     
    11821191 
    11831192    $page = get_query_var('cpage'); 
    1184      
     1193 
    11851194    if ( !$page ) 
    11861195        $page = 1; 
     
    12101219 */ 
    12111220function previous_comments_link($label='') { 
    1212     global $wp_query; 
    12131221 
    12141222    if ( !is_singular() ) 
     
    12231231        return; 
    12241232 
    1225     $nextpage = intval($page) - 1; 
     1233    $prevpage = intval($page) - 1; 
    12261234 
    12271235    if ( empty($label) ) 
    12281236        $label = __('« Older Comments'); 
    12291237 
    1230     echo '<a href="' . clean_url(get_comments_pagenum_link($nextpage)); 
     1238    echo '<a href="' . clean_url(get_comments_pagenum_link($prevpage)); 
    12311239    $attr = apply_filters( 'previous_comments_link_attributes', '' ); 
    12321240    echo "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>'; 
Note: See TracChangeset for help on using the changeset viewer.