Changeset 2522
- Timestamp:
- 04/09/2005 07:09:26 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment-functions.php
r2518 r2522 43 43 global $wpdb, $comment_count_cache; 44 44 $comment_id = (int) $comment_id; 45 if (!isset($comment_count_cache[$comment_id])) 46 $number = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$comment_id' AND comment_approved = '1'"); 47 else 48 $number = $comment_count_cache[$comment_id]; 49 return apply_filters('get_comments_number', $number); 45 if (!isset($comment_count_cache[$comment_id])) 46 $comment_count_cache[$comment_id] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$comment_id' AND comment_approved = '1'"); 47 48 return apply_filters('get_comments_number', $comment_count_cache[$comment_id]); 50 49 } 51 50 … … 95 94 96 95 if (! is_single() && ! is_page()) { 97 if ( '' == $comment_count_cache["$id"]) {98 $number= $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';");99 } else { 100 $number = $comment_count_cache["$id"];101 } 96 if ( !isset($comment_count_cache[$id])) 97 $comment_count_cache[$id] = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';"); 98 99 $number = $comment_count_cache[$id]; 100 102 101 if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) { 103 102 echo $none;
Note: See TracChangeset
for help on using the changeset viewer.