Family Encyclopedia >> Electronics

How to Display Total Comments Count on Your WordPress Site

Want to showcase the total number of comments on your WordPress site? Comments drive user engagement and build community around your content. Displaying this count encourages more participation. In this guide, we'll walk you through simple, proven methods to display your total approved comments.

How to Display Total Comments Count on Your WordPress Site

Method 1: Use a Plugin to Show WordPress Comment Counts (Recommended for Beginners)

This approach is straightforward and ideal for all users, requiring no coding knowledge.

Start by installing and activating the Simple Blog Stats plugin. For detailed instructions, see our step-by-step guide to installing WordPress plugins.

After activation, head to Settings » Simple Blog Stats to configure options.

How to Display Total Comments Count on Your WordPress Site

The plugin provides shortcodes and template tags for displaying stats like total comments, registered users, categories, tags, and more.

Copy the shortcode [sbs_approved] to show your total approved comments. Use it in posts, pages, or text widgets. If it doesn't render in widgets, refer to our guide on shortcodes in sidebar widgets.

Method 2: Display Comment Counts with Custom Code

This requires editing files, so beginners should back up their site first. See our guide on safely adding code to WordPress.

Add this code to your theme's functions.php file or a site-specific plugin:

function wpb_comment_count() {
    $comments_count = wp_count_comments();
    $message = 'There are <strong>' . $comments_count->approved . '</strong> comments published by our users.';
    return $message;
}
add_shortcode('wpb_total_comments', 'wpb_comment_count');
add_filter('widget_text', 'do_shortcode');

This function retrieves your approved comment count and creates a shortcode [wpb_total_comments]. Customize the message as needed, then use the shortcode in posts, pages, or widgets.

Here's how it appears on our test site:

How to Display Total Comments Count on Your WordPress Site

That covers displaying total comments on WordPress. For more engagement, check our guide to 11 Ways to Get More Comments on Your Blog Posts.

Liked this? Subscribe to our WordPress YouTube channel for video tutorials. Follow us on Twitter and Facebook for tips.