How to display total number of comments on WordPress blog
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); ?> |