Kreativ Font - Kreativ Sound - Kreativ Theme

WordPress Codex: wp_count_comments()

wp_count_comments() is a WordPress function that can retrieve a total comment count for the entire website site or for a single article.

Usage

Parameters
$post_id
(integer) (optional) The post ID
to retrieve a comment count for.
Default: None

Return values
(object)
with values approved, moderated,
spam, trash, total_comments.

Examples
Retrieve Comment Count for a Post
$comments_count = wp_count_comments( 2492 );
echo "Comments for post 2492
";
echo "Comments in moderation: " .
$comments_count->moderated . "
";
echo "Comments approved: " .
$comments_count->approved . "
";
echo "Comments in Spam: " .
$comments_count->spam . "
";
echo "Comments in Trash: " .
$comments_count->trash . "
";
echo "Total Comments: " .
$comments_count->total_comments . "
";
?>

More info: http://codex.wordpress.org/Function_Reference/wp_count_comments

Leave a comment

or Subscribe to this comment feed via RSS