Do you want to show the total number of comments on your WordPress site? Comments are a great way for users to engage with your blog content. By displaying the total comment count, you can encourage more people to join the conversation. In this detailed guide, we will show you how to easily display the total number of comments on your WordPress website.
When users see that others are commenting on your posts, they are more likely to leave a comment themselves. This is a form of social proof, showing that your blog has an active community. By default, WordPress shows the number of comments for each individual post, but it does not show the total number of comments for the entire website. Displaying this total count can be an effective way to encourage more engagement.
Method 1: Display WordPress Comment Count Using a Plugin (Easy)
The simplest way to display the total comment count is by using a plugin called Simple Blog Stats. This plugin shows the total number of approved comments and those in moderation, excluding pings and trackbacks. Many sites turn off trackbacks and pingbacks to avoid spam, so this might not be an issue for you.
First, you need to install and activate the Simple Blog Stats plugin. If you need help, check out guides on how to install a WordPress plugin. After activation, go to the Settings » Simple Blog Stats page. Here, you will see all the shortcodes you can use to display different stats, including the total number of comments.
To show the total count of all approved comments, use the shortcode [sbs_approved]
. If you want to include comments in moderation, use [sbs_comments]
. You can add these shortcodes to any post, page, or widget area.
For example, to display the comment count in a post or page, go to the editor and add a Shortcode block. Then, paste the shortcode into the block. You can add text before or after the shortcode if you wish.
To display the total comment count in a sidebar, go to Appearance » Widgets. Add a Paragraph widget to your chosen widget area and paste the shortcode into the widget. This will display the total comment count across your entire site.
Method 2: Display Comment Count Using Code (Most Accurate)
If you want to include pingbacks and trackbacks in your total comment count, you will need to add custom code to your site. Instead of editing the theme’s functions.php file directly, which can be risky, you can use the WPCode plugin.
First, install and activate the WPCode plugin. After activation, go to Code Snippets » Add Snippet. Create a new snippet by choosing the ‘PHP Snippet’ option and enter a title like ‘Total Comment Count Display’. Then, paste the following code into 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>
Total Comments:
<span class=”comment–count“><?php echo esc_html($total_comments); ?></span>
</p>
</div>
Choose the ‘Shortcode’ option for insertion, so you can place the shortcode in specific pages or widget areas. Activate and save the snippet, and WPCode will provide a shortcode you can use. Insert this shortcode in any part of your website where you want to display the total comment count.
Bonus Tip: Use Thrive Comments to Boost Comment Engagement
If you want to enhance your comment section further, consider using a plugin like Thrive Comments. This plugin allows you to add features such as likes and dislikes, which can help highlight valuable comments and foster more engagement. You can also set up a comment redirect action to keep users engaged by sending them to related posts or encouraging them to sign up for your email list.
By using these methods, you can easily display the total number of comments on your WordPress site and encourage more user interaction with your blog content.