Comments in WordPress allow users to engage with site content. Displaying the total number of comments can encourage more interaction. One way to do this is by using a plugin like Simple Blog Stats, which provides shortcodes for displaying statistics like comment count. Alternatively, you can manually add code to your theme’s functions.php file to create a function and shortcode for showing comment totals. This allows flexibility in displaying the information on posts, pages, or widgets. Both methods are discussed in detail, with steps on how to implement each one effectively.
Comments are a great way for users to engage with the content on your site. By showing the total number of comments, you can encourage more users to join the conversation.
In this article, we’ll walk you through two easy ways to display the total number of comments in WordPress, with or without a plugin.
Display Total Comments in WordPress Using a Plugin
Using a plugin is the easiest method and is recommended for all users. Simply install and activate the "Simple Blog Stats" plugin. Once activated, head to Settings » Simple Blog Stats to configure the settings for the plugin.
On the plugin’s settings page, you’ll find all the shortcodes you can use to display various statistics, including total comments. Copy the shortcode [sbs_approved] to display the total number of approved comments on your site.
You can then add this shortcode to a post or page by pasting it into the WordPress content editor or using it inside a paragraph block for additional styling options. Save your changes, and you’ll see the total comments displayed on your site.
Show Total Comments in Sidebar Widget
You can also use the same shortcode inside a text widget and add it to your blog sidebar. Just go to Appearance » Widgets, add a Text widget to the sidebar, paste the shortcode, and save the widget settings.
Show Total WordPress Comments (No Plugin Needed)
If you prefer not to use a plugin, you can manually display the total number of comments by adding a piece of code to your theme’s functions.php file. The code creates a function to output the total number of approved comments and a shortcode to display it.
You can then use the shortcode [wpb_total_comments] in posts, pages, or text widgets to show the total comments on your site.
Epilogue
We hope these two methods make it easy for you to display the total number of comments in WordPress. For more WordPress tips and tricks, be sure to follow the Hocwordpress Group fanpage for the latest articles.
Rate this article: Hocwordpress Group