How to Display the Total Number of Comments on WordPress?

Display Total Number of Comments

Do you want to display the total number of comments on the WordPress website?

Comments enable your users to participate and engage with the content available on your website. By displaying its total number can encourage more users to join the conversation.

In this article, we will discuss how you can display the total comments on the WordPress website.

We will cover 2 different ways i.e. 

  • By using WordPress plugin
  • By using codes

If you are a technical user and have a good knowledge of coding, you can follow the first step.

However, if you are a layman or a non-coder, then you can follow the second step.

So, let’s get started with this tutorial:

i) Display Total Number of Comments using WordPress Plugin

To carry out this step, you need to install and activate Simple Blog Stats plugin on your WordPress website.

Upon activating the plugin, go to Settings >> Simple Blog Stats page to configure the settings of the plugin.

In this place, you will see the shortcodes to show different stats related to total number of comments, registered users, number of posts, categories, page counts, etc.

Display Total Number of Comments on Sidebar

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

If you want to display the total number of comments on page/post then create a new post or simply edit the existing one.

On the post editing screen, add the shortcode block and paste the copied shortcode.

Paste Shortcode on Shortcode Block

Alternatively, you can add the shortcode on the paragraph block where you can style up the text using the text styling options.

Paste Shortcode on Paragraph Block

You can see the comment count like the screenshot below on your website.

Total Number of Comments

ii)Display Total Number of Comments Using Codes

If you have good coding skills, then you can manually the total comment count of your website using codes.

For this method, you need to enter the following code to the theme’s function.php file.

function wpb_comment_count() {

$comments_count = wp_count_comments();

$message =  ‘There are <strong>’.  $comments_count->approved . ‘</strong> comments posted by our users.’;

return $message;

}

add_shortcode(‘wpb_total_comments’,’wpb_comment_count’);

Go to Appearance >> Theme Editor and paste the code.

Then, copy the shortcode [wpb_total_comments]on any page, post, custom post type or widgets to display the total comment counts.

Now, the comment count like the one in the screenshot below can be seen.

Total Number of Comments

Wrapping Up

We hope this article is helpful for your to display total number of comments posted on your WordPress website. If you like this article, you can learn similiar step by step tutorial from our post category: Learn WordPress – Tutorials

Get latest updates, deals and more from us!
Deals, Updates
and more...
No Thoughts on How to Display the Total Number of Comments on WordPress?

Leave A Comment

Search