TutZone- Tutorials, Design news and Inspiration | ![]() |
How To Display Total Number of Comments in WordPress Posted: 05 Oct 2010 07:38 AM PDT Sometimes its cool to display your blog’s statistics to your viewers and visitors if they are really good, so as to grab some attention. That can also attract some new followers to your blog. Below trick can help you with same, this trick will let you display your total number of comments on your blog. Hope you like it. Procedure:Note: Do take backup of your theme before you try this. 01. Just Add below code in your theme where you want to display your total number of comments: <?php $numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'"); if (0 < $numcomms) $numcomms = number_format($numcomms); echo "There's ".$numcomms." total comments on my blog"; ?> This concludes this simple and useful tutorial. Hope you like it. |
You are subscribed to email updates from TutZone To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment