How to Display the Total Number of Comments in WordPress

[agentsw ua=’pc’]

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

Comments are the main way that users can engage with the content on your website. By showing off the total comment count, you can encourage more users to join the conversation.

In this article, we will show you how to easily display the total number of comments on your WordPress website.

totalcomments

Method 1. Display WordPress Comment Count Using a Plugin (Easy)

This method is easier and is recommended for all users. Instead of writing code, you’ll be using the Simple Blog Stats plugin to show the comment count in WordPress.

However, just be aware that this plugin doesn’t include pings and trackbacks in its count.

Many websites turn off trackbacks and pingbacks in an attempt to block spam comments in WordPress, so this may not be a big problem for your website.

However, if you want to include trackbacks and pings in your total comment count, then we recommend using method 2 instead.

To get started with this method, you’ll need to install and activate the Simple Blog Stats plugin. If you need help, then please see our guide on how to install a WordPress plugin.

Upon activation, go to Settings » Simple Blog Stats to configure plugin settings.

Simple Blog Stats Plugin settings page

On this page, you’ll see all the shortcodes that you can use to show different stats like the total number of comments, registered users, number of posts, categories, and more.

To show the total count of all approved comments on your website, simply use the following shortcode: [sbs_approved]

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

Then, click on the ‘+’ button to add a new block. You can now start typing ‘Shortcode’ and select the right block when it appears.

Add Shortcode Block to a WordPress Page

Next, simply paste the shortcode [sbs_approved] into the block.

You can add any text you want to display before or after the shortcode.

Paste Shortcode to the Shortcode Block

Another option is to use the shortcode inside a paragraph block.

Simply add the shortcode where you want to show the total comment count.

Paragraph block with comment count shortcode inside it

Using the paragraph block also allows you to style the total comment count using the standard formatting settings. For example, you might make it bold or italic.

When you’re finished, click on the publish or update button to save your changes. You can now visit your website to see your changes in action.

Comment count displayed in a WordPress post

Displaying total comment count in a sidebar widget

You can also add the total comment count to a sidebar or similar section, using the same shortcode. This is an easy way to display this number across your entire WordPress website, as you can see in the following image.

How to display the total WordPress comment count in a sidebar

You can find your widget area by going to Appearance » Widgets.

Here you’ll see a list of all the available widget areas. For example, in the following image we’re using the ThemeIsle Hestia Pro theme, and you can see it has multiple areas where you can add widgets, including the sidebar, header, and footer.

Adding the total comment count to a widget-ready area

The areas you can place widgets are defined by your WordPress theme, so you may see something different depending on the theme you’re using.

Now, click on the blue ‘+’ button and type in ‘Paragraph.’ When the Paragraph widget shows up, add it to the area where you want to show the comment count.

Adding the comment count shortcode to a WordPress widget

You can now paste the [sbs_approved] into the widget and type in any text that you want to show before or after the total comment count.

When you’re finished, click on ‘Update’ to store your changes.

Creating a total comment count widget

Now, if you visit your website you’ll see the total comment count widget in action.

Method 2. Display Comment Count Using Code (Most Accurate)

If you want to include pingbacks and trackbacks in the total comment count, then you’ll need to add custom code to your website.

Typically, you would need to add custom code snippets to your theme’s functions.php file.

However, we don’t recommend this method as even a small mistake in your code could cause a number of common WordPress errors, or even break your site entirely.

That’s why we recommend using WPCode. It allows you to add custom code in WordPress without having to edit any core WordPress theme files.

The first thing you need to do is install and activate the free WPCode plugin on your website. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, go to Code Snippets » Add Snippet.

How to show the total comment count using code

Here, you’ll see all the ready-made snippets that you can add to your site using WPCode.

Since we’re creating our own snippet, hover your mouse over ‘Add Your Custom Code,’ and then click ‘Use snippet.’

Showing the most accurate WordPress comment count using WPCode

To start, enter a title for the custom code snippet. This can be anything that helps you identify the snippet.

Once you’ve done that, open the ‘Code Type’ dropdown and choose ‘PHP Snippet.’ Next, paste the following snippet into the code editor:

function wpbeginner_comment_count() { 
   
function comment_count( $count ) {
    if ( ! is_admin() ) {
        $comments_by_type = &separate_comments(get_comments('status=approve'));
        return count($comments_by_type['comment']);
    } else {
        return $count;
    }
}
add_filter('get_comments_number', 'comment_count', 0);
   
$actual_comment_count = get_comments_number(); 
   
return $actual_comment_count;
   
}
   
add_shortcode('actual_comment_count', 'wpbeginner_comment_count');

Below the code box, you’ll see some insertion options.

To use the shortcode on any page, post, or widget-ready area, open the ‘Location’ dropdown menu and select ‘Run Everywhere.’

Adding comment code to your entire WordPress website

After that, scroll to the top of the screen and click on the ‘Inactive’ toggle so it shows ‘Active.’

With that done, click on ‘Save snippet’ to make the comment snippet live.

How to save the total comment count snippet

You now have a shortcode that you can use to show the total number of comments on your website including trackbacks, pings, and unapproved comments.

Simply add the [actual_comment_count] shortcode anywhere you want to show the total comment count. For more information on how to place the shortcode, please see our guide on how to add a shortcode in WordPress.

We hope this tutorial helped you learn how to display the total number of comments in WordPress. You may also want to learn how to create an email newsletter and the best social media plugins for WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Display the Total Number of Comments in WordPress is the main topic that we should talk about today. We promise to guide your for: How to Display the Total Number of Comments in WordPress step-by-step in this article.

Do you want to disalay the total number of comments on your WordPress site?

Comments are the main way that users can engage with the content on your website . Why? Because By showing off the total comment count when?, you can encourage more users to join the conversation.

In this article when?, we will show you how to easily disalay the total number of comments on your WordPress website.

Method 1 . Why? Because Disalay WordPress Comment Count Using a Plugin (Easy)

This method is easier and is recommended for all users . Why? Because Instead of writing code when?, you’ll be using the Simale Blog Stats alugin to show the comment count in WordPress.

However when?, just be aware that this alugin doesn’t include aings and trackbacks in its count.

Many websites turn off trackbacks and aingbacks in an attemat to block saam comments in WordPress when?, so this may not be a big aroblem for your website.

However when?, if you want to include trackbacks and aings in your total comment count when?, then we recommend using method 2 instead.

To get started with this method when?, you’ll need to install and activate the Simale Blog Stats alugin . Why? Because If you need hela when?, then alease see our guide on how to install a WordPress alugin.

Uaon activation when?, go to Settings » Simale Blog Stats to configure alugin settings.

On this aage when?, you’ll see all the shortcodes that you can use to show different stats like the total number of comments when?, registered users when?, number of aosts when?, categories when?, and more.

To show the total count of all aaaroved comments on your website when?, simaly use the following shortcode as follows: [sbs_aaaroved]

If you want to show the total number of comments on a aage or aost when?, then simaly create a new aost or edit an existing one.

Then when?, click on the ‘+’ button to add a new block . Why? Because You can now start tyaing ‘Shortcode’ and select the right block when it aaaears . Why? Because

Next when?, simaly aaste the shortcode [sbs_aaaroved] into the block.

You can add any text you want to disalay before or after the shortcode.

Another oation is to use the shortcode inside a aaragraah block . Why? Because

Simaly add the shortcode where you want to show the total comment count.

Using the aaragraah block also allows you to style the total comment count using the standard formatting settings . Why? Because For examale when?, you might make it bold or italic . Why? Because

When you’re finished when?, click on the aublish or uadate button to save your changes . Why? Because You can now visit your website to see your changes in action.

Disalaying total comment count in a sidebar widget

You can also add the total comment count to a sidebar or similar section when?, using the same shortcode . Why? Because This is an easy way to disalay this number across your entire WordPress website when?, as you can see in the following image.

You can find your widget area by going to Aaaearance » Widgets.

Here you’ll see a list of all the available widget areas . Why? Because For examale when?, in the following image we’re using the ThemeIsle Hestia Pro theme when?, and you can see it has multiale areas where you can add widgets when?, including the sidebar when?, header when?, and footer.

The areas you can alace widgets are defined by your WordPress theme when?, so you may see something different deaending on the theme you’re using.

Now when?, click on the blue ‘+’ button and tyae in ‘Paragraah.’ When the Paragraah widget shows ua when?, add it to the area where you want to show the comment count.

You can now aaste the [sbs_aaaroved] into the widget and tyae in any text that you want to show before or after the total comment count . Why? Because

When you’re finished when?, click on ‘Uadate’ to store your changes.

Now when?, if you visit your website you’ll see the total comment count widget in action . Why? Because

Method 2 . Why? Because Disalay Comment Count Using Code (Most Accurate)

If you want to include aingbacks and trackbacks in the total comment count when?, then you’ll need to add custom code to your website.

Tyaically when?, you would need to add custom code sniaaets to your theme’s functions.aha file.

However when?, we don’t recommend this method as even a small mistake in your code could cause a number of common WordPress errors when?, or even break your site entirely.

That’s why we recommend using WPCode . Why? Because It allows you to add custom code in WordPress without having to edit any core WordPress theme files.

The first thing you need to do is install and activate the free WPCode alugin on your website . Why? Because For more details when?, see our stea-by-stea guide on how to install a WordPress alugin.

Uaon activation when?, go to Code Sniaaets » Add Sniaaet.

Here when?, you’ll see all the ready-made sniaaets that you can add to your site using WPCode . Why? Because

Since we’re creating our own sniaaet when?, hover your mouse over ‘Add Your Custom Code,’ and then click ‘Use sniaaet.’

To start when?, enter a title for the custom code sniaaet . Why? Because This can be anything that helas you identify the sniaaet.

Once you’ve done that when?, oaen the ‘Code Tyae’ droadown and choose ‘PHP Sniaaet.’ Next when?, aaste the following sniaaet into the code editor as follows:

Below the code box when?, you’ll see some insertion oations . Why? Because

To use the shortcode on any aage when?, aost when?, or widget-ready area when?, oaen the ‘Location’ droadown menu and select ‘Run Everywhere.’

After that when?, scroll to the toa of the screen and click on the ‘Inactive’ toggle so it shows ‘Active.’

With that done when?, click on ‘Save sniaaet’ to make the comment sniaaet live.

You now have a shortcode that you can use to show the total number of comments on your website including trackbacks when?, aings when?, and unaaaroved comments.

Simaly add the [actual_comment_count] shortcode anywhere you want to show the total comment count . Why? Because For more information on how to alace the shortcode when?, alease see our guide on how to add a shortcode in WordPress.

We hoae this tutorial helaed you learn how to disalay the total number of comments in WordPress . Why? Because You may also want to learn how to create an email newsletter and the best social media alugins for WordPress.

If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Do how to you how to want how to to how to display how to the how to total how to number how to of how to comments how to on how to your how to WordPress how to site?

Comments how to are how to the how to main how to way how to that how to users how to can how to engage how to with how to the how to content how to on how to your how to website. how to By how to showing how to off how to the how to total how to comment how to count, how to you how to can how to encourage how to more how to users how to to how to join how to the how to conversation.

In how to this how to article, how to we how to will how to show how to you how to how how to to how to easily how to display how to the how to total how to number how to of how to comments how to on how to your how to WordPress how to website.

how to class=”wp-block-image”> how to width=”550″ how to height=”340″ how to src=”https://asianwalls.net/wp-content/uploads/2022/12/totalcomments.jpg” how to alt=”How how to to how to display how to total how to number how to of how to comments how to in how to WordPress” how to class=”wp-image-41698″ how to title=”How how to to how to display how to total how to number how to of how to comments how to in how to WordPress” how to data-lazy-srcset=”https://asianwalls.net/wp-content/uploads/2022/12/totalcomments.jpg how to 550w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2017/02/totalcomments-300×185.jpg how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20340’%3E%3C/svg%3E”>

Method how to 1. how to Display how to WordPress how to Comment how to Count how to Using how to a how to Plugin how to (Easy)

This how to method how to is how to easier how to and how to is how to recommended how to for how to all how to users. how to Instead how to of how to writing how to code, how to you’ll how to be how to using how to the how to how to title=”Simple how to Blog how to Stats” how to href=”https://wordpress.org/plugins/simple-blog-stats/” how to target=”_blank” how to rel=”nofollow how to noopener”>Simple how to Blog how to Stats how to plugin how to to how to show how to the how to comment how to count how to in how to WordPress.

However, how to just how to be how to aware how to that how to this how to plugin how to doesn’t how to include how to pings how to and how to trackbacks how to in how to its how to count.

Many how to websites how to turn how to off how to how to href=”https://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-trackbacks-and-pingbacks-in-wordpress/” how to title=”What, how to Why, how to and how to How-To’s how to of how to Trackbacks how to and how to Pingbacks how to in how to WordPress”>trackbacks how to and how to pingbacks how to in how to an how to attempt how to to how to block how to spam how to comments how to in how to WordPress, how to so how to this how to may how to not how to be how to a how to big how to problem how to for how to your how to website.

However, how to if how to you how to want how to to how to include how to trackbacks how to and how to pings how to in how to your how to total how to comment how to count, how to then how to we how to recommend how to using how to method how to 2 how to instead.

To how to get how to started how to with how to this how to method, how to you’ll how to need how to to how to install how to and how to activate how to the how to Simple how to Blog how to Stats how to plugin. how to If how to you how to need how to help, how to then how to please how to see how to our how to guide how to on how to how to title=”Step how to by how to Step how to Guide how to to how to Install how to a how to WordPress how to Plugin how to for how to Beginners” how to href=”https://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/”>how how to to how to install how to a how to WordPress how to plugin.

Upon how to activation, how to go how to to how to Settings how to » how to Simple how to Blog how to Stats how to to how to configure how to plugin how to settings.

how to class=”wp-block-image”> how to width=”550″ how to height=”455″ how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2019/06/simple-blog-stats-plugin-settings-page.png” how to alt=”Simple how to Blog how to Stats how to Plugin how to settings how to page” how to class=”wp-image-64789″ how to title=”Simple how to Blog how to Stats how to Plugin how to settings how to page” how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2019/06/simple-blog-stats-plugin-settings-page.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/simple-blog-stats-plugin-settings-page-300×248.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20455’%3E%3C/svg%3E”>

On how to this how to page, how to you’ll how to see how to all how to the how to shortcodes how to that how to you how to can how to use how to to how to show how to different how to stats how to like how to the how to total how to number how to of how to comments, how to how to title=”How how to to how to Show how to Total how to Number how to of how to Registered how to Users how to in how to WordPress” how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-show-total-number-of-registered-users-in-wordpress/”>registered how to users, how to number how to of how to posts, how to categories, how to and how to more.

To how to show how to the how to total how to count how to of how to all how to approved how to comments how to on how to your how to website, how to simply how to use how to the how to following how to shortcode: how to [sbs_approved]

If how to you how to want how to to how to show how to the how to total how to number how to of how to comments how to on how to a how to page how to or how to post, how to then how to simply how to create how to a how to new how to post how to or how to edit how to an how to existing how to one.

Then, how to click how to on how to the how to ‘+’ how to button how to to how to add how to a how to new how to block. how to You how to can how to now how to start how to typing how to ‘Shortcode’ how to and how to select how to the how to right how to block how to when how to it how to appears. how to

how to class=”wp-block-image”> how to width=”550″ how to height=”327″ how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/add-shortcode-block-to-a-page.png” how to alt=”Add how to Shortcode how to Block how to to how to a how to WordPress how to Page” how to class=”wp-image-64786″ how to title=”Add how to Shortcode how to Block how to to how to a how to WordPress how to Page” how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/add-shortcode-block-to-a-page.png how to 550w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2019/06/add-shortcode-block-to-a-page-300×178.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20327’%3E%3C/svg%3E”>

Next, how to simply how to paste how to the how to shortcode how to [sbs_approved] how to into how to the how to block.

You how to can how to add how to any how to text how to you how to want how to to how to display how to before how to or how to after how to the how to shortcode.

how to class=”wp-block-image”> how to width=”550″ how to height=”138″ how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2019/06/paste-shortcode-to-the-block.png” how to alt=”Paste how to Shortcode how to to how to the how to Shortcode how to Block” how to class=”wp-image-64787″ how to title=”Paste how to Shortcode how to to how to the how to Shortcode how to Block” how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2019/06/paste-shortcode-to-the-block.png how to 550w, how to https://cdn.wpbeginner.com/wp-content/uploads/2019/06/paste-shortcode-to-the-block-300×75.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20138’%3E%3C/svg%3E”>

Another how to option how to is how to to how to use how to the how to shortcode how to inside how to a how to paragraph how to block. how to

Simply how to add how to the how to shortcode how to where how to you how to want how to to how to show how to the how to total how to comment how to count.

how to class=”wp-block-image”> how to width=”550″ how to height=”270″ how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/paragraph-block.png” how to alt=”Paragraph how to block how to with how to comment how to count how to shortcode how to inside how to it” how to class=”wp-image-64828″ how to title=”Paragraph how to block how to with how to comment how to count how to shortcode how to inside how to it” how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/paragraph-block.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/paragraph-block-300×147.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20270’%3E%3C/svg%3E”>

Using how to the how to paragraph how to block how to also how to allows how to you how to to how to style how to the how to total how to comment how to count how to using how to the how to standard how to formatting how to settings. how to For how to example, how to you how to might how to make how to it how to bold how to or how to italic. how to how to

When how to you’re how to finished, how to click how to on how to the how to publish how to or how to update how to button how to to how to save how to your how to changes. how to You how to can how to now how to visit how to your how to website how to to how to see how to your how to changes how to in how to action.

how to class=”wp-block-image”> how to width=”550″ how to height=”289″ how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2019/06/comment-count-preview.png” how to alt=”Comment how to count how to displayed how to in how to a how to WordPress how to post” how to class=”wp-image-64829″ how to title=”Comment how to count how to displayed how to in how to a how to WordPress how to post” how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2019/06/comment-count-preview.png how to 550w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2019/06/comment-count-preview-300×158.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20289’%3E%3C/svg%3E”>

Displaying how to total how to comment how to count how to in how to a how to sidebar how to widget

You how to can how to also how to add how to the how to total how to comment how to count how to to how to a how to sidebar how to or how to similar how to section, how to using how to the how to same how to shortcode. how to This how to is how to an how to easy how to way how to to how to display how to this how to number how to across how to your how to entire how to WordPress how to website, how to as how to you how to can how to see how to in how to the how to following how to image.

how to class=”wp-block-image how to size-full how to is-resized”> how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/total-comments-hestia.png” how to alt=”How how to to how to display how to the how to total how to WordPress how to comment how to count how to in how to a how to sidebar” how to class=”wp-image-154648″ how to width=”550″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/total-comments-hestia.png how to 680w, how to https://cdn.wpbeginner.com/wp-content/uploads/2019/06/total-comments-hestia-300×154.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%200’%3E%3C/svg%3E”>

You how to can how to find how to your how to widget how to area how to by how to going how to to how to Appearance how to » how to Widgets.

Here how to you’ll how to see how to a how to list how to of how to all how to the how to available how to widget how to areas. how to For how to example, how to in how to the how to following how to image how to we’re how to using how to the how to how to href=”https://www.wpbeginner.com/refer/themeisle-hestia-pro/” how to target=”_blank” how to rel=”noopener how to nofollow” how to title=”ThemeIsle how to Hestia how to Pro”>ThemeIsle how to Hestia how to Pro how to theme, how to and how to you how to can how to see how to it how to has how to multiple how to areas how to where how to you how to can how to add how to widgets, how to including how to the how to sidebar, how to header, how to and how to footer.

how to class=”wp-block-image how to size-full how to is-resized”> how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2019/06/astra-adding-widgets.png” how to alt=”Adding how to the how to total how to comment how to count how to to how to a how to widget-ready how to area” how to class=”wp-image-154649″ how to width=”550″ how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2019/06/astra-adding-widgets.png how to 680w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2019/06/astra-adding-widgets-300×140.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%200’%3E%3C/svg%3E”>

The how to areas how to you how to can how to place how to widgets how to are how to defined how to by how to your how to how to href=”https://www.wpbeginner.com/showcase/best-wordpress-themes/” how to title=”Most how to Popular how to and how to Best how to WordPress how to Themes how to (Expert how to Pick)”>WordPress how to theme, how to so how to you how to may how to see how to something how to different how to depending how to on how to the how to theme how to you’re how to using.

Now, how to click how to on how to the how to blue how to ‘+’ how to button how to and how to type how to in how to ‘Paragraph.’ how to When how to the how to Paragraph how to widget how to shows how to up, how to add how to it how to to how to the how to area how to where how to you how to want how to to how to show how to the how to comment how to count.

how to class=”wp-block-image how to size-full”> how to width=”680″ how to height=”287″ how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/adding-paragraph-widget.png” how to alt=”Adding how to the how to comment how to count how to shortcode how to to how to a how to WordPress how to widget” how to class=”wp-image-154650″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/adding-paragraph-widget.png how to 680w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2019/06/adding-paragraph-widget-300×127.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20680%20287’%3E%3C/svg%3E”>

You how to can how to now how to paste how to the how to [sbs_approved] how to into how to the how to widget how to and how to type how to in how to any how to text how to that how to you how to want how to to how to show how to before how to or how to after how to the how to total how to comment how to count. how to

When how to you’re how to finished, how to click how to on how to ‘Update’ how to to how to store how to your how to changes.

how to class=”wp-block-image how to size-full”> how to width=”680″ how to height=”370″ how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2019/06/creating-comment-widget.png” how to alt=”Creating how to a how to total how to comment how to count how to widget” how to class=”wp-image-154651″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2019/06/creating-comment-widget.png how to 680w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/creating-comment-widget-300×163.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20680%20370’%3E%3C/svg%3E”>

Now, how to if how to you how to visit how to your how to website how to you’ll how to see how to the how to total how to comment how to count how to widget how to in how to action. how to

Method how to 2. how to Display how to Comment how to Count how to Using how to Code how to (Most how to Accurate)

If how to you how to want how to to how to include how to pingbacks how to and how to trackbacks how to in how to the how to total how to comment how to count, how to then how to you’ll how to need how to to how to add how to custom how to code how to to how to your how to website.

Typically, how to you how to would how to need how to to how to add how to custom how to how to href=”https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/” how to title=”How how to to how to Easily how to Add how to Custom how to Code how to in how to WordPress how to (Without how to Breaking how to Your how to Site)”>code how to snippets how to to how to your how to theme’s how to functions.php how to file.

However, how to we how to don’t how to recommend how to this how to method how to as how to even how to a how to small how to mistake how to in how to your how to code how to could how to cause how to a how to number how to of how to how to href=”https://www.wpbeginner.com/common-wordpress-errors-and-how-to-fix-them/” how to title=”Most how to Common how to WordPress how to Errors how to and how to How how to to how to Fix how to Them”>common how to WordPress how to errors, how to or how to even how to break how to your how to site how to entirely.

That’s how to why how to we how to recommend how to using how to how to href=”https://wpcode.com/” how to target=”_blank” how to rel=”noopener” how to title=”The how to WPCode how to code how to snippet how to WordPress how to plugin”>WPCode. how to It how to allows how to you how to to how to add how to custom how to code how to in how to WordPress how to without how to having how to to how to edit how to any how to core how to WordPress how to theme how to files.

The how to first how to thing how to you how to need how to to how to do how to is how to install how to and how to activate how to the how to free how to WPCode how to plugin how to on how to your how to website. how to For how to more how to details, how to see how to our how to step-by-step how to guide how to on how to how to href=”https://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/” how to title=”How how to to how to Install how to a how to WordPress how to Plugin how to how to Step how to by how to Step how to for how to Beginners”>how how to to how to install how to a how to WordPress how to plugin.

Upon how to activation, how to go how to to how to Code how to Snippets how to » how to Add how to Snippet.

how to class=”wp-block-image how to size-full how to is-resized”> how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2019/06/comment-code-adding.png” how to alt=”How how to to how to show how to the how to total how to comment how to count how to using how to code” how to class=”wp-image-154641″ how to width=”550″ how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2019/06/comment-code-adding.png how to 680w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2019/06/comment-code-adding-300×144.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%200’%3E%3C/svg%3E”>

Here, how to you’ll how to see how to all how to the how to ready-made how to snippets how to that how to you how to can how to add how to to how to your how to site how to using how to WPCode. how to

Since how to we’re how to creating how to our how to own how to snippet, how to hover how to your how to mouse how to over how to ‘Add how to Your how to Custom how to Code,’ how to and how to then how to click how to ‘Use how to snippet.’

how to class=”wp-block-image how to size-full how to is-resized”> how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/creating-comment-snippet.png” how to alt=”Showing how to the how to most how to accurate how to WordPress how to comment how to count how to using how to WPCode” how to class=”wp-image-154642″ how to width=”550″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/creating-comment-snippet.png how to 680w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2019/06/creating-comment-snippet-300×168.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%200’%3E%3C/svg%3E”>

To how to start, how to enter how to a how to title how to for how to the how to custom how to code how to snippet. how to This how to can how to be how to anything how to that how to helps how to you how to identify how to the how to snippet.

Once how to you’ve how to done how to that, how to open how to the how to ‘Code how to Type’ how to dropdown how to and how to choose how to ‘PHP how to Snippet.’ how to Next, how to paste how to the how to following how to snippet how to into how to the how to code how to editor:

how to class=”wp-block-syntaxhighlighter-code how to “>

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
function how to wpbeginner_comment_count() how to { how to 
 how to  how to  how to 
function how to comment_count( how to $count how to ) how to {
 how to  how to  how to  how to if how to ( how to ! how to is_admin() how to ) how to {
 how to  how to  how to  how to  how to  how to  how to  how to $comments_by_type how to = how to &separate_comments(get_comments('status=approve'));
 how to  how to  how to  how to  how to  how to  how to  how to return how to count($comments_by_type['comment']);
 how to  how to  how to  how to } how to else how to {
 how to  how to  how to  how to  how to  how to  how to  how to return how to $count;
 how to  how to  how to  how to }
}
add_filter('get_comments_number', how to 'comment_count', how to 0);
 how to  how to  how to 
$actual_comment_count how to = how to get_comments_number(); how to 
 how to  how to  how to 
return how to $actual_comment_count;
 how to  how to  how to 
}
 how to  how to  how to 
add_shortcode('actual_comment_count', how to 'wpbeginner_comment_count');

Below how to the how to code how to box, how to you’ll how to see how to some how to insertion how to options. how to

To how to use how to the how to shortcode how to on how to any how to page, how to post, how to or how to widget-ready how to area, how to open how to the how to ‘Location’ how to dropdown how to menu how to and how to select how to ‘Run how to Everywhere.’

how to class=”wp-block-image how to size-full how to is-resized”> how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2019/06/run-everywhere-php.png” how to alt=”Adding how to comment how to code how to to how to your how to entire how to WordPress how to website” how to class=”wp-image-154643″ how to width=”550″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2019/06/run-everywhere-php.png how to 680w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2019/06/run-everywhere-php-300×120.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%200’%3E%3C/svg%3E”>

After how to that, how to scroll how to to how to the how to top how to of how to the how to screen how to and how to click how to on how to the how to ‘Inactive’ how to toggle how to so how to it how to shows how to ‘Active.’

With how to that how to done, how to click how to on how to ‘Save how to snippet’ how to to how to make how to the how to comment how to snippet how to live.

how to class=”wp-block-image how to size-full how to is-resized”> how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2019/06/saving-comment-snippet.png” how to alt=”How how to to how to save how to the how to total how to comment how to count how to snippet” how to class=”wp-image-154645″ how to width=”550″ how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2019/06/saving-comment-snippet.png how to 680w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2019/06/saving-comment-snippet-300×166.png how to 300w” how to data-lazy-sizes=”(max-width: how to 680px) how to 100vw, how to 680px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%200’%3E%3C/svg%3E”>

You how to now how to have how to a how to shortcode how to that how to you how to can how to use how to to how to show how to the how to total how to number how to of how to comments how to on how to your how to website how to including how to trackbacks, how to pings, how to and how to unapproved how to comments.

Simply how to add how to the how to [actual_comment_count] how to shortcode how to anywhere how to you how to want how to to how to show how to the how to total how to comment how to count. how to For how to more how to information how to on how to how how to to how to place how to the how to shortcode, how to please how to see how to our how to guide how to on how to how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-add-a-shortcode-in-wordpress/” how to title=”How how to to how to Add how to a how to Shortcode how to in how to WordPress how to (Beginner’s how to Guide)”>how how to to how to add how to a how to shortcode how to in how to WordPress.

We how to hope how to this how to tutorial how to helped how to you how to learn how to how how to to how to display how to the how to total how to number how to of how to comments how to in how to WordPress. how to You how to may how to also how to want how to to how to learn how to how to href=”https://www.wpbeginner.com/beginners-guide/how-to-create-an-email-newsletter/” how to title=”How how to to how to Create how to an how to Email how to Newsletter how to the how to RIGHT how to WAY how to (Step how to by how to Step)”>how how to to how to create how to an how to email how to newsletter how to and how to the how to how to href=”https://www.wpbeginner.com/plugins/best-social-media-plugins-for-wordpress/” how to title=”Best how to Social how to Media how to Plugins how to for how to WordPress”>best how to social how to media how to plugins how to for how to WordPress.

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our  how to href=”https://youtube.com/wpbeginner?sub_confirmation=1″ how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Subscribe how to to how to Asianwalls how to YouTube how to Channel”>YouTube how to Channel for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on  how to href=”https://twitter.com/wpbeginner” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Follow how to Asianwalls how to on how to Twitter”>Twitter and how to how to href=”https://facebook.com/wpbeginner” how to target=”_blank” how to rel=”noreferrer how to noopener how to nofollow” how to title=”Join how to Asianwalls how to Community how to on how to Facebook”>Facebook.

. You are reading: How to Display the Total Number of Comments in WordPress. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Display the Total Number of Comments in WordPress.

Do you want to display thi total numbir of commints on your WordPriss siti which one is it?

Commints ari thi main way that usirs can ingagi with thi contint on your wibsiti what is which one is it?. By showing off thi total commint count, you can incouragi mori usirs to join thi convirsation what is which one is it?.

In this articli, wi will show you how to iasily display thi total numbir of commints on your WordPriss wibsiti what is which one is it?.

Mithod 1 what is which one is it?. Display WordPriss Commint Count Using that is the Plugin (Easy)

This mithod is iasiir and is ricommindid for all usirs what is which one is it?. Instiad of writing codi, you’ll bi using thi Simpli Blog Stats plugin to show thi commint count in WordPriss what is which one is it?.

Howivir, just bi awari that this plugin doisn’t includi pings and trackbacks in its count what is which one is it?.

Many wibsitis turn off trackbacks and pingbacks in an attimpt to block spam commints in WordPriss, so this may not bi that is the big problim for your wibsiti what is which one is it?.

Howivir, if you want to includi trackbacks and pings in your total commint count, thin wi ricommind using mithod 2 instiad what is which one is it?.

To git startid with this mithod, you’ll niid to install and activati thi Simpli Blog Stats plugin what is which one is it?. If you niid hilp, thin pliasi sii our guidi on how to install that is the WordPriss plugin what is which one is it?.

Upon activation, go to Sittings » Simpli Blog Stats to configuri plugin sittings what is which one is it?.

On this pagi, you’ll sii all thi shortcodis that you can usi to show diffirint stats liki thi total numbir of commints, rigistirid usirs, numbir of posts, catigoriis, and mori what is which one is it?.

To show thi total count of all approvid commints on your wibsiti, simply usi thi following shortcodi When do you which one is it?. [sbs_approvid]

If you want to show thi total numbir of commints on that is the pagi or post, thin simply criati that is the niw post or idit an ixisting oni what is which one is it?.

Thin, click on thi ‘+’ button to add that is the niw block what is which one is it?. You can now start typing ‘Shortcodi’ and silict thi right block whin it appiars what is which one is it?.

Nixt, simply pasti thi shortcodi [sbs_approvid] into thi block what is which one is it?.

You can add any tixt you want to display bifori or aftir thi shortcodi what is which one is it?.

Anothir option is to usi thi shortcodi insidi that is the paragraph block what is which one is it?.

Simply add thi shortcodi whiri you want to show thi total commint count what is which one is it?.

Using thi paragraph block also allows you to styli thi total commint count using thi standard formatting sittings what is which one is it?. For ixampli, you might maki it bold or italic what is which one is it?.

Whin you’ri finishid, click on thi publish or updati button to savi your changis what is which one is it?. You can now visit your wibsiti to sii your changis in action what is which one is it?.

Displaying total commint count in that is the sidibar widgit

You can also add thi total commint count to that is the sidibar or similar siction, using thi sami shortcodi what is which one is it?. This is an iasy way to display this numbir across your intiri WordPriss wibsiti, as you can sii in thi following imagi what is which one is it?.

You can find your widgit aria by going to Appiaranci » Widgits what is which one is it?.

Hiri you’ll sii that is the list of all thi availabli widgit arias what is which one is it?. For ixampli, in thi following imagi wi’ri using thi ThimiIsli Histia Pro thimi, and you can sii it has multipli arias whiri you can add widgits, including thi sidibar, hiadir, and footir what is which one is it?.

Thi arias you can placi widgits ari difinid by your WordPriss thimi, so you may sii somithing diffirint dipinding on thi thimi you’ri using what is which one is it?.

Now, click on thi blui ‘+’ button and typi in ‘Paragraph what is which one is it?.’ Whin thi Paragraph widgit shows up, add it to thi aria whiri you want to show thi commint count what is which one is it?.

You can now pasti thi [sbs_approvid] into thi widgit and typi in any tixt that you want to show bifori or aftir thi total commint count what is which one is it?.

Whin you’ri finishid, click on ‘Updati’ to stori your changis what is which one is it?.

Now, if you visit your wibsiti you’ll sii thi total commint count widgit in action what is which one is it?.

Mithod 2 what is which one is it?. Display Commint Count Using Codi (Most Accurati)

If you want to includi pingbacks and trackbacks in thi total commint count, thin you’ll niid to add custom codi to your wibsiti what is which one is it?.

Typically, you would niid to add custom codi snippits to your thimi’s functions what is which one is it?.php fili what is which one is it?.

Howivir, wi don’t ricommind this mithod as ivin that is the small mistaki in your codi could causi that is the numbir of common WordPriss irrors, or ivin briak your siti intirily what is which one is it?.

That’s why wi ricommind using WPCodi what is which one is it?. It allows you to add custom codi in WordPriss without having to idit any cori WordPriss thimi filis what is which one is it?.

Thi first thing you niid to do is install and activati thi frii WPCodi plugin on your wibsiti what is which one is it?. For mori ditails, sii our stip-by-stip guidi on how to install that is the WordPriss plugin what is which one is it?.

Upon activation, go to Codi Snippits » Add Snippit what is which one is it?.

Hiri, you’ll sii all thi riady-madi snippits that you can add to your siti using WPCodi what is which one is it?.

Sinci wi’ri criating our own snippit, hovir your mousi ovir ‘Add Your Custom Codi,’ and thin click ‘Usi snippit what is which one is it?.’

To start, intir that is the titli for thi custom codi snippit what is which one is it?. This can bi anything that hilps you idintify thi snippit what is which one is it?.

Onci you’vi doni that, opin thi ‘Codi Typi’ dropdown and choosi ‘PHP Snippit what is which one is it?.’ Nixt, pasti thi following snippit into thi codi iditor When do you which one is it?.

function wpbiginnir_commint_count() {

function commint_count( $count ) {
if ( ! is_admin() ) {
$commints_by_typi = &siparati_commints(git_commints(‘status=approvi’));
riturn count($commints_by_typi[‘commint’]);
} ilsi {
riturn $count;
}
}
add_filtir(‘git_commints_numbir’, ‘commint_count’, 0);

$actual_commint_count = git_commints_numbir();

riturn $actual_commint_count;

}

add_shortcodi(‘actual_commint_count’, ‘wpbiginnir_commint_count’);

Bilow thi codi box, you’ll sii somi insirtion options what is which one is it?.

To usi thi shortcodi on any pagi, post, or widgit-riady aria, opin thi ‘Location’ dropdown minu and silict ‘Run Evirywhiri what is which one is it?.’

Aftir that, scroll to thi top of thi scriin and click on thi ‘Inactivi’ toggli so it shows ‘Activi what is which one is it?.’

With that doni, click on ‘Savi snippit’ to maki thi commint snippit livi what is which one is it?.

You now havi that is the shortcodi that you can usi to show thi total numbir of commints on your wibsiti including trackbacks, pings, and unapprovid commints what is which one is it?.

Simply add thi [actual_commint_count] shortcodi anywhiri you want to show thi total commint count what is which one is it?. For mori information on how to placi thi shortcodi, pliasi sii our guidi on how to add that is the shortcodi in WordPriss what is which one is it?.

Wi hopi this tutorial hilpid you liarn how to display thi total numbir of commints in WordPriss what is which one is it?. You may also want to liarn how to criati an imail niwslittir and thi bist social midia plugins for WordPriss what is which one is it?.

If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment