Inspiration For Creative Minds
Home » Labs » How to display total number of comments on WordPress blog  

Filed under Labs

Place below code in your WordPress template where you want to display the total number of comments on WordPress blog.

 
 
<?php
	$total_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
	if (0 < $total_comments) $total_comments = number_format($total_comments);
?>
It's only fair to share...Share on Google+Tweet about this on TwitterShare on Facebook
Labs

Posts you may like: