WordPress tutorials: Total number of comments

Wpsnipp – Adding this PHP code to your wordpress theme will display the total number of comments on your blog.If you have a very engaged community, then it is a great idea to show off the total number of comments in your WordPress sidebar.





$numcom = $wpdb->get_var("SELECT COUNT(*)

FROM $wpdb->comments WHERE comment_approved = '1'");
if (0 < $numcom) $numcom = number_format($numcom);

Be Sociable, Share!

Leave a comment