Changeset 9667
- Timestamp:
- 11/13/2008 08:36:36 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment-template.php
r9540 r9667 1214 1214 $r = wp_parse_args( $args, $defaults ); 1215 1215 1216 // Figure out what comments we'll be looping through ($_comments) 1217 if ( null !== $comments ) { 1218 $comments = (array) $comments; 1219 if ( empty($comments) ) 1220 return; 1221 if ( 'all' != $r['type'] ) { 1222 $comments_by_type = &separate_comments($comments); 1223 if ( empty($comments_by_type[$r['type']]) ) 1224 return; 1225 $_comments = $comments_by_type[$r['type']]; 1226 } else { 1227 $_comments = $comments; 1228 } 1229 } else { 1230 if ( empty($wp_query->comments) ) 1231 return; 1232 if ( 'all' != $r['type'] ) { 1233 if ( empty($wp_query->comments_by_type) ) 1234 $wp_query->comments_by_type = &separate_comments($wp_query->comments); 1235 if ( empty($wp_query->comments_by_type[$r['type']]) ) 1236 return; 1237 $_comments = $wp_query->comments_by_type[$r['type']]; 1238 } else { 1239 $_comments = $wp_query->comments; 1240 } 1241 } 1242 1216 1243 if ( '' === $r['per_page'] && get_option('page_comments') ) 1217 1244 $r['per_page'] = get_query_var('comments_per_page'); … … 1230 1257 1231 1258 if ( '' === $r['page'] ) { 1232 if ( empty($ comments) ) {1259 if ( empty($overridden_cpage) ) { 1233 1260 $r['page'] = get_query_var('cpage'); 1234 1261 } else { 1235 if ( empty($overridden_cpage) ) { 1236 $r['page'] = get_query_var('cpage'); 1237 } else { 1238 $threaded = ( -1 == $r['max_depth'] ) ? false : true; 1239 $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($comments, $r['per_page'], $threaded) : 1; 1240 set_query_var( 'cpage', $r['page'] ); 1241 } 1262 $threaded = ( -1 == $r['max_depth'] ) ? false : true; 1263 $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($_comments, $r['per_page'], $threaded) : 1; 1264 set_query_var( 'cpage', $r['page'] ); 1242 1265 } 1243 1266 } … … 1253 1276 1254 1277 if ( empty($walker) ) 1255 $walker = new Walker_Comment; 1256 1257 if ( empty($comments) ) { 1258 if ( empty($wp_query->comments) ) 1259 return; 1260 if ( 'all' != $type ) { 1261 if ( empty($wp_query->comments_by_type) ) 1262 $wp_query->comments_by_type = &separate_comments($wp_query->comments); 1263 if ( empty($wp_query->comments_by_type[$type]) ) 1264 return; 1265 $walker->paged_walk($wp_query->comments_by_type[$type], $max_depth, $page, $per_page, $r); 1266 $wp_query->max_num_comment_pages = $walker->max_pages; 1267 return; 1268 } 1269 $walker->paged_walk($wp_query->comments, $max_depth, $page, $per_page, $r); 1270 $wp_query->max_num_comment_pages = $walker->max_pages; 1271 } else { 1272 if ( empty($comments) ) 1273 return; 1274 if ( 'all' != $type ) { 1275 $comments_by_type = &separate_comments($comments); 1276 if ( empty($comments_by_type[$type]) ) 1277 return; 1278 $walker->paged_walk($comments_by_type[$type], $max_depth, $page, $per_page, $r); 1279 $wp_query->max_num_comment_pages = $walker->max_pages; 1280 return; 1281 } 1282 $walker->paged_walk($comments, $max_depth, $page, $per_page, $r); 1283 $wp_query->max_num_comment_pages = $walker->max_pages; 1284 } 1278 $walker = new Walker_Comment; 1279 1280 $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r); 1281 $wp_query->max_num_comment_pages = $walker->max_pages; 1285 1282 } 1286 1283
Note: See TracChangeset
for help on using the changeset viewer.