2025-03-24 11:51:36
If you have ever noticed the comments section of a website, you might see numbers indicating the number of comments received for each blog post. These numbers are not just statistics; they also reflect the level of engagement and activity of the community on your website.
If you want to display the most accurate number of comments on your WordPress website, this article will help you do it easily.
Comments allow readers to interact with you and other visitors, which can create a strong community and encourage people to return to your website. Therefore, you should find ways to increase the number of comments, such as:
However, WordPress does not have a default option to automatically display the correct number of comments, especially if your website receives a lot of trackbacks and pings, or if there are unapproved comments. So, let's learn how to accurately display the number of comments using a free plugin.
The Simple Blog Stats plugin is the easiest way to display the number of approved comments and comments in the moderation queue. However, this plugin does not count pings and trackbacks.
Usage instructions:
If you need more details about using shortcodes, please refer to the instructions on how to add shortcodes in WordPress.
If you want to display the total number of comments, including trackbacks and pings, you can use additional PHP code to create a custom shortcode.
Usage instructions:
function wp_custom_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);
return get_comments_number();
}
add_shortcode('actual_comment_count', 'wp_custom_comment_count');
If you want to display the number of comments for a specific post or page, use the following code in WPCode:
function wp_custom_post_comment_count() {
function comment_count( $count ) {
if ( ! is_admin() ) {
global $post;
$comments_by_type = &separate_comments(get_comments('status=approve&post_id='. $post->ID ));
return count($comments_by_type['comment']);
} else {
return $count;
}
}
add_filter('get_comments_number', 'comment_count', 0);
return get_comments_number();
}
add_shortcode('post_comment_count', 'wp_custom_post_comment_count');
Then use the shortcode [post_comment_count] in the post or page where you want to display the specific comment count.
If you want to increase comments on your website, we recommend using Thrive Comments, a plugin that enhances the efficiency of the commenting system with the following features:
Displaying accurate comment counts can help increase engagement on your website. If you want a simple and quick method, you can use the Simple Blog Stats plugin. However, if you want to include trackbacks and pings, you can use a Custom Shortcode through the WPCode plugin.
We hope this article will help you easily display the correct number of comments on your WordPress website. If you're interested in increasing website traffic, please check out our guide on boosting blog traffic.
2025-01-10 10:12:01
2024-05-31 03:06:49
2024-05-28 03:09:25
There are many other interesting articles, try selecting them from below.
2024-12-16 09:41:15
2024-03-22 03:12:18
2025-01-23 09:21:51
2025-01-24 01:16:31
2023-10-17 04:52:45
2023-11-21 09:27:00
2023-09-14 10:59:15
2025-03-14 02:33:37
2023-10-05 01:42:29