Ticket #7927: 7927.6.patch
| File 7927.6.patch, 2.2 KB (added by , 17 years ago) |
|---|
-
wp-includes/comment-template.php
730 730 * @return null Returns null if no comments appear 731 731 */ 732 732 function 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; 734 734 735 735 if ( ! (is_single() || is_page() || $withcomments) ) 736 736 return; … … 762 762 $comments_by_type = &$wp_query->comments_by_type; 763 763 } 764 764 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') ) { 766 767 set_query_var( 'cpage', get_comment_pages_count() ); 768 $overridden_cpage = TRUE; 769 } 767 770 768 771 define('COMMENTS_TEMPLATE', true); 769 772 … … 1129 1132 * @param array $comments Optional array of comment objects. Defaults to $wp_query->comments 1130 1133 */ 1131 1134 function 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; 1133 1136 1134 1137 $comment_alt = $comment_thread_alt = 0; 1135 1138 $comment_depth = 1; … … 1158 1161 if ( empty($comments) ) { 1159 1162 $r['page'] = get_query_var('cpage'); 1160 1163 } 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 } 1164 1171 } 1165 1172 } 1166 1173 // Validation check