国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
Method 1: Use simple blog statistics (fast and easy)
Method 2: Use custom shortcodes (including ping, citations, and unapproved comments)
Home CMS Tutorial WordPress How to display the most accurate comment count in WordPress

How to display the most accurate comment count in WordPress

Apr 20, 2025 am 07:36 AM
wordpress Why 2025

Do you want to display the most accurate number of comments in WordPress?

Your WordPress site may have comments, spam, quote announcements, and pings that are pending review. This makes it difficult to display the exact number of comments on your website.

In this article, we will show you how to easily display the most accurate comment count on your WordPress website.

How to display the most accurate comment count in WordPress

Why display accurate comment counts in WordPress?

Comments allow readers to interact with you and other visitors. This helps create a sense of community and bring people back to your website. That being said, you will want to do everything you can to get more comments on your WordPress posts.

You can allow users to subscribe to comments, ask questions in each post to try to spark discussions, and more. Another option is to display accurate comment counts.

High comment counts will make visitors want to join the conversation. It's also a social proof, as readers may visit your post just to understand why so many people have commented.

There is no default way to display accurate comment counts in WordPress, especially when your website receives a lot of citations and pings. Spam can also make it difficult to display accurate comment counts.

That being said, let's see how to use the free plugin to display accurate comment counts on WordPress websites. Just use the quick link below to jump directly to the method you want to use:

  • Method 1: Use simple blog statistics (fast and easy)
  • Method 2: Use custom shortcodes (including ping, citations, and unapproved comments)

Method 1: Use simple blog statistics (fast and easy)

The easiest way to display accurate comment counts is to use simple blog statistics. This plugin displays the total number of approved comments and reviewed comments. However, ping and reference are not included in its count.

Many websites turn off Trackback and pingback to block spam in WordPress, so this may not be a big problem for your website. However, if you want to include reference references and pings in your comment count, then we recommend using Method 2.

First, you need to install and activate the Simple Blog Statistics plugin. For more details, see our step-by-step guide on how to install WordPress plug-ins.

Once activated, you can view all the short codes for the plugin by going to the Settings ? Simple Blog Statistics page.

How to display the most accurate comment count in WordPress

Here, just click to expand the Shortcode section.

To display the total number of approved comments on your WordPress blog, simply use the following shortcode: [sbs_approved]

How to display the most accurate comment count in WordPress

If you want to display the total number of approved comments and comments that are still in the WordPress comment review queue, you can use [sbs_comments].

For more information on how to place shortcodes, see our guide on how to add shortcodes in WordPress.

How to display the most accurate comment count in WordPress

After adding the shortcode, you can visit the WordPress website to view the total number of comments in real time.

Method 2: Use custom shortcodes (including ping, citations, and unapproved comments)

If you want to include pingback and trackback in the total number of comments, you need to add custom code to your website.

Typically, the tutorial will ask you to add custom code snippets to the theme's functions.php file. However, we do not recommend using this method, as a small error in the code can cause many common WordPress errors. Or worse yet, completely destroy your website.

This is why we recommend using WPCode. This is the easiest and safest way to add custom code in WordPress without editing any 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 WordPress plug-ins.

Once activated, you need to go to Code Snippet ? Add snippet .

How to display the most accurate comment count in WordPress

Here you will see all the ready-made snippets of WPCode that you can add to your website.

We will create a custom shortcode that allows you to add accurate comment counts to any page, post, or widget ready area. First, hover over Add Custom Code and click Use Code Snippets.

How to display the most accurate comment count in WordPress

First, you need to enter the title of the custom code snippet. This can be anything that can help you identify snippets of code in your WordPress dashboard.

After that, just open the Code Type drop-down list and select PHP Fragment.

How to display the most accurate comment count in WordPress

Once done, just paste the following code snippet into the code editor:

How to display the most accurate comment count in WordPress

After that, scroll to the top of the screen and click Inactive to change it to Active.

Once you're done, just click Save Code Snippet to make the code snippet appear on your website.

How to display the most accurate comment count in WordPress

You now have a shortcode that can be used to display the total number of comments, including quotes, pings, and unapproved comments.

[actual_comment_count] Just add a shortcode anywhere you want to display the number of comments. For more information on how to place shortcodes, see our guide on how to add shortcodes in WordPress.

Show comment counts for specific WordPress posts

Do you want to display the number of comments for a single post or page?

You can add the following PHP code snippet to WPCode by following the same procedure above:

 functionwpbeginner_post_comment_count() { functioncomment_count( $count) { if( ! is_admin() ) { global$post; $comments_by_type= &separate_comments(get_comments('status=approve&post_id='. $post->ID )); returncount($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('post_comment_count', 'wpbeginner_post_comment_count');

Depend on

Use it with one click in WordPress

This will create a [post_comment_count] shortcode that you can add to any page or post.

We hope this article helps you understand how to easily display the most accurate comment count in WordPress. You might also want to read our guide on how to increase your blog traffic, or check out our expert selection of the best contact form plugins for WordPress.

The above is the detailed content of How to display the most accurate comment count in WordPress. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is Impossible Cloud Network (ICNT)? How? A comprehensive introduction to the ICN project that Binance will launch soon What is Impossible Cloud Network (ICNT)? How? A comprehensive introduction to the ICN project that Binance will launch soon Jul 07, 2025 pm 07:06 PM

Contents 1. What is ICN? 2. ICNT latest updates 3. Comparison and economic model between ICN and other DePIN projects and economic models 4. Conclusion of the next stage of the DePIN track At the end of May, ICN (ImpossibleCloudNetwork) @ICN_Protocol announced that it had received strategic investment in NGPCapital with a valuation of US$470 million. Many people's first reaction was: "Has Xiaomi invested in Web3?" Although this was not Lei Jun's direct move, the one who had bet on Xiaomi, Helium, and WorkFusion

Binance Exchange Official Website Portal Binance Official Website Portal Binance Exchange Official Website Portal Binance Official Website Portal Jul 04, 2025 pm 11:06 PM

The latest version of Binance is v2.102.5, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.

Binance Exchange app Android version Binance Exchange Chinese version installation package direct Binance Exchange app Android version Binance Exchange Chinese version installation package direct Jul 04, 2025 pm 10:54 PM

The latest version of Binance is v2.102.5, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.

Binance Official Portal Global Crypto Asset Trading Core Portal Binance Official Portal Global Crypto Asset Trading Core Portal Jul 04, 2025 pm 11:03 PM

The latest version of Binance is v2.102.5, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.

The latest official version of virtual currency trading platform v6.129.0 Android app 2025 new version The latest official version of virtual currency trading platform v6.129.0 Android app 2025 new version Jul 07, 2025 pm 10:15 PM

The latest official version of the virtual currency trading platform v6.129.0 is a professional and secure digital asset trading application created for Android users. It provides rich market conditions, convenient trading functions and multiple security protection, and is committed to providing users with a first-class trading experience.

Binance official website link Binance official website entrance address Binance official website link Binance official website entrance address Jul 04, 2025 pm 11:18 PM

The latest version of Binance is 2.101.8, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.

The popularity of the currency circle has returned, why do smart people have begun to quietly increase their positions? Look at the trend from the on-chain data and grasp the next round of wealth password! The popularity of the currency circle has returned, why do smart people have begun to quietly increase their positions? Look at the trend from the on-chain data and grasp the next round of wealth password! Jul 09, 2025 pm 08:30 PM

As the market conditions pick up, more and more smart investors have begun to quietly increase their positions in the currency circle. Many people are wondering what makes them take decisively when most people wait and see? This article will analyze current trends through on-chain data to help readers understand the logic of smart funds, so as to better grasp the next round of potential wealth growth opportunities.

Binance official website entrance address Binance official website entrance and registration guide Binance official website entrance address Binance official website entrance and registration guide Jul 04, 2025 pm 10:57 PM

The latest version of Binance is v2.102.5, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.

See all articles