Ticket #7927: 7927.patch
| File 7927.patch, 1.9 KB (added by , 17 years ago) |
|---|
-
wp-includes/comment-template.php
762 762 $comments_by_type = &$wp_query->comments_by_type; 763 763 } 764 764 765 // Set the default comments page to the last page (this isn't perfect) 766 if ( '' == get_query_var('cpage') && get_option('page_comments') ) { 767 if ( get_option('thread_comments') ) { 768 $walker = new Walker_Comment; 769 $lastpage = floor( $walker->get_number_of_root_elements( $wp_query->comments ) / get_query_var('comments_per_page') ); 770 } else { 771 $lastpage = floor( count( $wp_query->comments ) / get_query_var('comments_per_page') ); 772 } 773 774 set_query_var('cpage', $lastpage); 775 } 776 765 777 define('COMMENTS_TEMPLATE', true); 766 778 767 779 $include = apply_filters('comments_template', STYLESHEETPATH . $file ); -
wp-includes/link-template.php
1174 1174 } 1175 1175 } 1176 1176 1177 function get_comments_pagenum_link( $pagenum = 1) {1177 function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) { 1178 1178 global $wp_rewrite; 1179 1179 1180 1180 $pagenum = (int) $pagenum; … … 1190 1190 1191 1191 $base = trailingslashit( get_bloginfo( 'home' ) ); 1192 1192 1193 if ( $pagenum > 1) {1193 if ( $pagenum != $max_page ) { 1194 1194 $result = add_query_arg( 'cpage', $pagenum, $base . $request ); 1195 1195 } else { 1196 1196 $result = $base . $request; … … 1225 1225 if ( empty($label) ) 1226 1226 $label = __('» Newer Comments'); 1227 1227 1228 echo '<a href="' . clean_url( get_comments_pagenum_link($nextpage));1228 echo '<a href="' . clean_url( get_comments_pagenum_link( $nextpage, $max_page ) ); 1229 1229 $attr = apply_filters( 'next_comments_link_attributes', '' ); 1230 1230 echo "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .'</a>'; 1231 1231 }