How to Display the Total Number of Comments in WordPress

Are you looking to showcase your WordPress site‘s vibrant community and encourage even more engagement? Displaying the total number of comments prominently on your site is a powerful tactic to achieve just that.

When visitors see that you have a high comment count, it serves as compelling social proof—signaling that your content resonates with your audience and is worth their time to read and interact with. It‘s a way of saying, "The party is happening here, come join the conversation!"

In this guide, we‘ll walk you through two methods to easily display your total WordPress comment count:

  1. Using the free Simple Blog Stats plugin
  2. Using a custom code snippet with the WPCode plugin for more flexibility

Whether you‘re a WordPress beginner or a seasoned pro, you‘ll find clear step-by-step instructions to get you up and running quickly.

Let‘s dive in!

Method 1: Display Total Comments Using Simple Blog Stats Plugin

Using a dedicated plugin is often the easiest route, especially if you want to avoid tinkering with any code. And Simple Blog Stats is one of the best options out there.

This free plugin not only allows you to display your total comment count with a simple shortcode, but also provides other useful stats like your post count, registered users, and more.

The one limitation to note is that Simple Blog Stats only includes approved comments in the total. Pingbacks, trackbacks, and moderated comments are not counted. For many sites this is perfectly fine, but if you want those included, check out the custom code method in the next section instead.

Here‘s how to get it set up:

Step 1. Install and Activate Simple Blog Stats

First, log in to your WordPress admin dashboard and navigate to Plugins → Add New. Search for "Simple Blog Stats".

Click the "Install Now" button next to the plugin name, then hit "Activate".

[Screenshot]

Step 2. Configure Plugin Settings (Optional)

Upon activation, you‘ll see a new Settings → Simple Blog Stats menu item. Clicking it will bring you to the plugin‘s settings page.

[Screenshot]

Here you can configure some optional settings like excluding certain post types from the calculations. But the default settings work great for most, so feel free to leave things as-is.

Step 3. Insert the Total Comments Shortcode

The real magic of Simple Blog Stats is its shortcodes. To display the total comment count, you‘ll specifically use the [sbs_approved] shortcode.

You can insert this in any post, page, text widget, or directly in a theme file.

Here are the most common placements to maximize visibility:

Homepage – Showcase your comment count on your high-traffic homepage so every visitor sees it.

Sidebar – Displaying it persistently in your sidebar makes it visible across your whole site.

Popular Post – Have an exceptionally popular post? Flaunt its comment count to entice even more engagement.

To insert the shortcode in the WordPress editor:

  1. Edit the post or page
  2. Click the "+" icon to add a new block
  3. Search for the "Shortcode" block and select it
  4. Paste the [sbs_approved] shortcode into the block
  5. Optionally, add some appealing text before or after it, like "Join [sbs_approved] readers in the discussion!"
  6. Save or publish the page
[Screenshot]

To insert it in a sidebar or widget area (appearance may vary based on theme):

  1. Go to Appearance → Widgets
  2. Drag a "Text" widget into the desired sidebar
  3. Paste the shortcode into the content area
  4. Give the widget a title if you wish, then save
[Screenshot]

And that‘s it! You should now see the total comment count displayed beautifully wherever you placed the shortcode.

[Screenshot example]

Method 2: Display Total Comments Using Custom Code

If you want the most accurate comment count possible, including pingbacks and trackbacks, using a custom code snippet is the way to go.

And to insert code snippets safely, we highly recommend the WPCode plugin. It allows you to add custom code without directly editing your theme files, which can cause issues if not done carefully.

Here‘s how to implement this method:

Step 1. Install and Activate WPCode

Install and activate the free WPCode plugin by going to Plugins → Add New and searching for it by name.

[Screenshot]

Step 2. Add a New Snippet

Upon activation, you‘ll see a new "Code Snippets" menu item. Go to Code Snippets → Add Snippet.

You‘ll be presented with a list of WPCode‘s pre-made snippet options. To add your own, click "Use snippet" under the "Add your custom code" section.

[Screenshot]

In the "Create Custom Snippet" page:

  1. Give your snippet a descriptive name
  2. Select the "PHP snippet" code type
  3. Paste the following code in the editor:
// Get the total comment count for the entire site
$total_comments = wp_count_comments()->total_comments;
// Output HTML for displaying the comment count
?>
<div class="comment-count-container">
<p>
<!-- Display the text "Total Comments". Feel free to adjust the text -->
Join the discussion with  <span class="comment-count"><?php echo esc_html($total_comments); ?></span> other readers!
</p>
</div>

This code first uses WordPress‘s wp_count_comments() function to retrieve the total count of all comments, including pingbacks and trackbacks.

Then it outputs that number wrapped in some HTML markup for styling. Feel free to customize the surrounding text.

[Screenshot]

Step 3. Select Shortcode Display Option

Under "Insertion Options", select the "Shortcode" radio button. This will generate a unique shortcode you can use to place the comment count anywhere you like.

Alternatively, if you have the premium version of WPCode, you can specify your own shortcode name here for easier use. Something like [total_comments] works well.

[Screenshot]

Step 4. Save and Activate Snippet

Finally, give your snippet a quick review. If all looks good, click the "Inactive" toggle at the top right to switch it to "Active", then hit "Save Snippet".

[Screenshot]

You‘re all set! You can now display the total comment count anywhere on your site using the generated shortcode from step 3.

Like the previous method, some effective placements include:

  • Homepage
  • Sidebar
  • Top posts/pages
  • Archives

Here‘s how the output looks using the code snippet on our demo site:

[Screenshot example]

Maximize the Impact of Displaying Total Comments

Showing off your total comment count is an excellent engagement tactic, but it works best as part of a broader comment engagement and growth strategy. Here are a few tips to get the most mileage out of it:

  • Encourage comments actively in your posts by asking questions
  • Moderate comments promptly and interact with commenters
  • Display recent comments to entice new ones
  • Make your comment form welcoming and easy to use
  • Reward top commenters with badges or features
  • Promote highly commented posts to keep the momentum going

By combining these techniques with prominently displaying your comment counts, you can create a thriving community that elevates your site to the next level.

Boost Your WordPress Comments Today

You now have two solid methods to choose from to start leveraging the power of social proof with your WordPress comment counts. Whether you opt for the simplicity of Simple Blog Stats or the flexibility of a custom WPCode snippet, your comment section is about to get a lot more lively.

To dive deeper into improving your comment section, check out these guides:

Here‘s to your thriving WordPress community!

Did you like this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.