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
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
Similar WordPress Themes
About Andrei O Nothing to say, only to do ... work, work ...
Leave a comment