Sometimes we want to display the number of comments on our posts content or on widgets for the specific posts…
…and for this, we need to build some shortcode.
We have posted the simple code snippets that will help you to easily display the comment count using a shortcode.
Just follow instruction:
Display Comment Count Using a Shortcode
First of all, You need to copy the below-embedded code and paste it into your WordPress theme‘s functions.php file.
Snippets for the function to display comment count with Shortcode:
Save the file and view the result by copy and paste the below shortcode into your posts or widgets…
…then change the to
comment id the post’s id of which you want to display the number of comments.
Show Comments Count Code:
Let us know what you think about this post in the comment section.
Don’t forget to share Display comment count using the shortcode.