Do you want to display the total number of comments on your WordPress site? Comments allow users to participate and interact with the content of your WordPress blog. By displaying your comment count, you can further encourage users to join the discussion. In this tutorial, we will show you how to easily view the total number of comments in your WordPress.

How to display the number of comments on wordpress

Method 1: How to display the number of comments with a plugin

This method is easier and is recommended for all users.

The first thing you need to do is install and activate the " Simple Blog Stats ". For more details, see our step-by-step guide on how to install a WordPress plugin.

After activating the plugin, you must visit " Settings »Simple Blog Stats To configure the plugin settings.

Simple blog stats plugin settings

The plugin allows you to display your statistics blog using shortcodes and template tags.

On this page you will be able to see all the shortcodes that you can use to display different statistics like total number of comments, registered users, categories, tags, and much more.

You must copy the [sbs_approved] shortcode to display the total number of approved comments on your WordPress site.

You can use this shortcode in an article, page, or WordPress text widget.

2 method. View WordPress Comment Count with Code

This method requires you to add code to your WordPress files. Discover our tutorial on the creation of WordPress Plugin.

First, you will need to add this code to functions.php file or to a specific file of your plugin.

function bpc_comment_count () {$ comments_count = wp_count_comments (); $ message = 'There are '. $ comments_count-> approved. ' comments posted by our visitors.'; return $ message; } add_shortcode ('bpc_total_comments', 'wpb_comment_count'); add_filter ('widget_text', 'do_shortcode');

This code simply creates a function that displays the total number of approved WordPress comments on your site. It then creates a shortcode to display it. You can customize the message that appears as needed.

Then, you can use the [wpb_total_comments] shortcode in your articles, pages, or text widget to see the total number of comments on your site.

Here's what the code will look like on your site.

Demonstration of the number of comments

That's all for this tutorial, I hope it will allow you to display the total number of comments on your WordPress blog.