Do you want to display total number of posts and comments ? even total number of online users ? in blogger / blogspot? Well, if your answer is No! then you can stop reading this article but If Your answer is YES! then let me first hug you, smarty, its very easy to display total number of comments, posts and online users in blogspot. All you have to do is copy-paste a JavaScript code in your blog and this code will show total number of comments, posts and online users. Everything will be updated automatically.
How to Add a Widget to Display Total Posts, Comments and Online Users ?
- Login Your blogger account and Go to Design
- Click on Add a Widget and select HTML/JavaScript gadget from the list.
- Copy this code and paste it in that gadget.
<script style="text/javascript">
function totalPosts(json) {
document.write('Total Posts: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
}
function totalComments(json) {
document.write('Total Comments: <b>' + json.feed.openSearch$totalResults.$t + '</b><br>');
}
</script>
<script src=" /feeds/posts/default?alt=json-in-script&callback=totalPosts"></script>
<script src=" /feeds/comments/default?alt=json-in-script&callback=totalComments"></script>
Users online: <b><script type="text/javascript" src="http://fastonlineusers.com/on3.php?d=EXAMPLE.com"></script></b>
Change Example.com to your blog address and you're done !
Widget will look like below shown image;