How to Display Total Number of Comments in WordPress – Short Course
Comments allow users to participate and engage with the content on your WordPress website/blog. So, displaying the total comment-count on your website will help to encourage more users/visitors to join the conversation. All in all, if you really want to display the total-number of comments on your WordPress website then this article will show you how to easily display all the comments in WordPress.
Method-1: How to display the display the total-number WordPress-comments using a plugin (Simple Blog Stats):
- Log into your WordPress-account and locate the plugin-marketplace: the first thing you will need to-do is logging into your WordPress account and then go-to Plugins >> Add New in order to get access to the WordPress plugin-marketplace. in fact, you will be capable of installing any plugin you want at free cost under the WordPress plugin-marketplace as shown in the illustration below;
Below is an illustration on how to locate the WordPress plugin-marketplace:
- Search for the “Simple Blog Stats plugin“: when your under the WordPress marketplace, search for “Simple Blog Stats plugin” using the integrated search-box on the upper-right section of the plugin-window and you will eventually see the plugin your looking for in the generated search-results as shown in the illustration below;
- Install and activate the “Simple Blog Stats plugin”: after searching and seeing the “Simple Blog Stats plugin“, click on the “Install” button to begin the installation-process and afterwards and activation-button will appear. so, you will also need to press on the “Activate” button to make the Simple Blog Stats plugin functional or ready for use as shown in the illustrations below;
Below is an illustration on where to press in order to activate the Simple Blog Stats plugin:
Note: upon activation, the Simple Blog Stats plugin will be automatically added to the installed-plugins menu and you will just need to configure it in order to start display all the comments within your website/blog by following the steps below.
- Configure the Simple Blog Stats plugin: in order for the Simple Blog Stats plugin to start operating as expected, you will need to configure it by simply going to Settings >> Simple Blog Stats and you will now gain access to the plugin-settings page just as shown in the illustration below;
- Click on “Shortcodes” to gain access to shortcodes to use: this plugin actually allows your website/blog to show stats using shortcodes and this implies that you will just have to click on the shortcode-link in order to view the different codes that can be used display your website/blog-stats. So, below is an illustration on how to access the different shortcodes to use within your website/blog.
Note: the Simple Blog Stats plugin will allow you to display blog-stats using shortcodes and you just need to copy any shortcode of a given blog-stat and then paste into a given post/page so that the blog-stats can be viewed on your live website/blog. In fact, this page features all the shortcodes that can be used to show different stats like; number of posts, number of pages, number of comments, number of registered users, number of words in a post/page, site last update and a lot more.
- Copy a shortcode responsible for displaying comments: there are actually several shortcodes responsible for displaying of comments which include; number of comments, number of moderated comments, number of approved comments. So, select from any of these shortcodes if you want to display the number of comments, moderated comments or approved comments on your website/blog.
Note: the [sbs_comments] shortcode displays the number of comments, [sbs_moderated] displays the number of moderated comments, [sbs_approved] displays the number of approved comments.
- Add the comment-shortcode into your post/page: after copying a particular shortcode that you would like to display into your post/page, open-up a new or existing page/post and then paste in the shortcode as shown in the illustration below:
Preview your shortcodes on your live website/blog: after adding and saving the comment-shortcodes, go to the post where you added the shortcodes on your website/blog and then check whether the number of different comment-options is being displayed. So, below is an illustration on how the comments appeared on my website after adding and saving the comment-shortcodes?
Note: shortcodes are actually very easy to use because you can place them anywhere within your post without even stressing yourself with complicated coding/programming.
- Click on Template-Tags to get different comment-tags: if you don’t like using shortcodes then consider clicking on the “Template Tags” link in order and then a list of different template tags that can be used for display on your website/blog will appear as shown in the illustration below:
However, for a Template-Tag you will need to place copy and paste it into the function-php file under WordPress-settings but this is a bit tricky and you need to be really careful when doing it.
Conclusion: you can use shortcodes in any WordPress Page, Post or Text-widget in order to display comments and other information about your website/blog. However, in case the shortcode doesn’t work in the text-widget then just consider pasting it into your posts/pages manually.
Method-2: How to display WordPress comment-count using codes:
This method will require you to add code to your WordPress-files but this may not be any process for a WordPress-beginners. In fact, it’s highly recommended for WordPress-beginners to use plugins instead of code to design and configure their websites in order to prevent unexpected errors. However, below are some of the steps that you can follow if you really want to display comment-count using code?
- Go to themes and locate function.php: after logging into your WordPress-account, go to Themes >> Editor and then locate for functions.php as shown in the illustration below.
You will need to scroll downwards to locate the comments php-file as shown in the illustration below;
- Add the comments-count code to function.php: you will need to copy and paste the comments-count code into fuctions.php file. below is the comments-count code you will need to copy and paste into your function.php file;
Note: this code will actually generate function that displays the total number of approved comments on your website/blog. In fact, it will even generate a shortcode to display it and you also be capable of customizing the output-message. Lastly, you will be able to use the [wpb_total_comments] shortcode in your WordPress pages, posts and text-widgets in order to display the total-number of comments on the website/blog.