Make WordPress Core


Ignore:
Timestamp:
10/24/2008 07:27:19 AM (18 years ago)
Author:
markjaquith
Message:

Fix comment paging for when $comments is passed in. props Viper007Bond. see #7927

File:
1 edited

Legend:

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

    r9296 r9317  
    731731 */
    732732function comments_template( $file = '/comments.php', $separate_comments = false ) {
    733         global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity;
     733        global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;
    734734
    735735        if ( ! (is_single() || is_page() || $withcomments) )
    … …  
    763763        }
    764764
    765         if ( '' == get_query_var('cpage') && get_option('page_comments') && 'newest' == get_option('default_comments_page') )
     765        $overridden_cpage = FALSE;
     766        if ( '' == get_query_var('cpage') && get_option('page_comments') && 'newest' == get_option('default_comments_page') ) {
    766767                set_query_var( 'cpage', get_comment_pages_count() );
     768                $overridden_cpage = TRUE;
     769        }
    767770
    768771        define('COMMENTS_TEMPLATE', true);
    … …  
    11301133 */
    11311134function wp_list_comments($args = array(), $comments = null ) {
    1132         global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt;
     1135        global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage;
    11331136
    11341137        $comment_alt = $comment_thread_alt = 0;
    … …  
    11591162                        $r['page'] = get_query_var('cpage');
    11601163                } else {
    1161                         $threaded = ( -1 == $r['depth'] ) ? false : true;
    1162                         $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($comments, $r['per_page'], $threaded) : 1;
    1163                         set_query_var( 'cpage', $r['page'] );
     1164                        if ( empty($overridden_cpage) ) {
     1165                                $r['page'] = get_query_var('cpage');
     1166                        } else {
     1167                                $threaded = ( -1 == $r['depth'] ) ? false : true;
     1168                                $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($comments, $r['per_page'], $threaded) : 1;
     1169                                set_query_var( 'cpage', $r['page'] );
     1170                        }
    11641171                }
    11651172        }
Note: See TracChangeset for help on using the changeset viewer.