Changeset 2881
- Timestamp:
- 09/15/2005 11:40:04 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment-functions.php
r2828 r2881 40 40 } 41 41 42 function get_comments_number( $comment_id ) { 43 global $wpdb, $comment_count_cache; 44 $comment_id = (int) $comment_id; 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'"); 42 function get_comments_number( $post_id = 0 ) { 43 global $wpdb, $comment_count_cache, $id; 44 $post_id = (int) $post_id; 45 46 if ( !$post_id ) 47 $post_id = $id; 48 49 if ( !isset($comment_count_cache[$post_id]) ) 50 $comment_count_cache[$post_id] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1'"); 47 51 48 return apply_filters('get_comments_number', $comment_count_cache[$ comment_id]);52 return apply_filters('get_comments_number', $comment_count_cache[$post_id]); 49 53 } 50 54
Note: See TracChangeset
for help on using the changeset viewer.