Wordpress Total Number of Comments

/ Published in: PHP
Save to your folder(s)

Copy this code and paste it in your HTML
  1. <?php $numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'"); if (0 < $numcomms) $numcomms = number_format($numcomms); ?>
  3. <?php echo "There's ".$numcomms." total comments on my blog"; ?>

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.