summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-includes/comment-functions.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-09-16 10:58:22 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-09-16 10:58:22 +0000
commit6ef403f52cb9d755a32535482ae0bedf793cfb5d (patch)
tree87ff8208c1f40dd81f4a9f7c57b3a282c974c42d /wp-inst/wp-includes/comment-functions.php
parent1ddd64978b062c9d7636012d247e0475e1f5f925 (diff)
downloadwordpress-mu-6ef403f52cb9d755a32535482ae0bedf793cfb5d.tar.gz
wordpress-mu-6ef403f52cb9d755a32535482ae0bedf793cfb5d.tar.xz
wordpress-mu-6ef403f52cb9d755a32535482ae0bedf793cfb5d.zip
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@335 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/comment-functions.php')
-rw-r--r--wp-inst/wp-includes/comment-functions.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/wp-inst/wp-includes/comment-functions.php b/wp-inst/wp-includes/comment-functions.php
index c62ed97..ee940f9 100644
--- a/wp-inst/wp-includes/comment-functions.php
+++ b/wp-inst/wp-includes/comment-functions.php
@@ -39,13 +39,17 @@ function clean_url( $url ) {
return $url;
}
-function get_comments_number( $comment_id ) {
- global $wpdb, $comment_count_cache;
- $comment_id = (int) $comment_id;
- if (!isset($comment_count_cache[$comment_id]))
- $comment_count_cache[$comment_id] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$comment_id' AND comment_approved = '1'");
+function get_comments_number( $post_id = 0 ) {
+ global $wpdb, $comment_count_cache, $id;
+ $post_id = (int) $post_id;
+
+ if ( !$post_id )
+ $post_id = $id;
+
+ if ( !isset($comment_count_cache[$post_id]) )
+ $comment_count_cache[$post_id] = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1'");
- return apply_filters('get_comments_number', $comment_count_cache[$comment_id]);
+ return apply_filters('get_comments_number', $comment_count_cache[$post_id]);
}
function comments_number( $zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $number = '' ) {