We can see the number of comments made in our dashboard, but our advertisers cannot see that. If you have a page for advertisers, you want to add this number to give them one more reason to buy advertisement on your site. Specially when you are selling ads towards the comment area.


All you have to do is paste the following code in a page where you want it displayed:

1 <?php
2 $count_posts = wp_count_posts();
3 $posts = $count_posts->publish;
5 $count_comments = get_comment_count();
6 $comments = $count_comments['approved'];
8 echo "There's a total of ".$comments." comments on my blog, with an average ".round($comments/$posts)." comments per post.";
9 ?>

This code will tell your advertisers or your audience, how many total comments your blog has, and an average number of comments on each post. Sometimes the per post number might be a decimal, but this code rounds it up to an integer value.

You can also show this number in your sidebar as a statistic if you so desire.

From http://www.wpbeginner.com/