How to add Total Posts and Comments Widget in Blogger You might have noticed that some Blogger blogs have widget installed in the sidebar which displays total posts and comments of that blog. We...
2018-07-31T07:46:21Z

How to add Total Posts and Comments Widget in Blogger

You might have noticed that some Blogger blogs have widget installed in the sidebar which displays total posts and comments of that blog. Well, you can also install such a widget in your blog as well. A simple script allows us to show off total posts and comments on our blog.

Total Posts & Comments Widget

Steps to Add the Widget

1. Go to Layout > Page Elements.
2. Click Add a Gadget link in your sidebar where you want to add this widget.
3. When a new window is opened, chose HTML/JavaScript as your widget and add the following code in the Content field.

<script style="text/javascript">
function numberOfPosts(json) {
document.write('Posts: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
}
function numberOfComments(json) {
document.write('Comments: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
}
</script>
<script src="http://www.yourdomain.com/feeds/posts/default?alt=json-in-script&callback=numberOfPosts"></script>
<script src="http://www.yourdomain.com/feeds/comments/default?alt=json-in-script&callback=numberOfComments"></script>

4. Save your widget and see the blog.

Widget Customization

Replace http://www.yourdomain.com/ with your own blog URL. You can change the Posts: and Comments: text to whatever you like for example you can replace Comments: with Total No. of Comments:.

So this was our guide on How to add Total Posts & Comments Widget in Blogger , I hope the methods given above helped you Show Total Posts & Comments.
Share it:

Blogger

Blogging

How To

Tutorial

Post A Comment:

0 comments: