The widget-ready areas are defined by your WordPress theme , so you may see something different depending on the theme you use.
Now click on the blue “+” button and type “Paragraph”. When the Paragraph widget appears, drag it to the area where you want to display the number of comments.
Adding the comment count shortcode to a WordPress widget
You can then paste the shortcode [sbs_approved]into the widget and enter any text you want to display before or after the total number of comments.
Note: If you're using a block-based theme , you can add the shortcode to a WordPress page, pattern, or template using the WordPress website editor. For more information, see our beginner's guide to editing WordPress websites .
Method 2: Display the number of comments using code (most accurate)
If you want to include pingbacks and trackbacks in the comment total, you will need to add your own code to your site .
Tutorials often ask you to add custom code list of switzerland cell phone number snippets to the theme's functions.php file , but we don't recommend this method because even a small mistake in your code can lead to a number of common WordPress errors or even break your website completely.
For this reason, we recommend using WPCode . It allows you to add custom code in WordPress without editing the 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 .
Once activated, go to Code Snippets » Add Snippet .
How to show the total comment count using code
Here you can see all the pre-made snippets you can add to your site with WPCode. This includes code to disable the comments section , disable pages with attachments, upload SVG files, disable automatic updates, and more.
To create your own snippet, hover over “Add Custom Code” and then click the “Use Snippet” button below.
Showing the most accurate WordPress comment count using WPCode
First, select the code type “PHP Snippet” from the list of options that appears on the screen.
Adding the total comment count to a widget-ready area
-
- Posts: 688
- Joined: Sat Dec 21, 2024 5:34 am