Blogspot Widget: Show Total Posts & Comments

Blogspot Widget: Show Total Posts & Comments

7 comments
How to Restore Pencil to Edit Posts

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.

Steps


Just go to Layout | Page Elements and click Add a Gadget link in your sidebar where you want to add this widget. 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>
<font color="blue"><script src="http://bloggerfaqs.blogspot.com/feeds/posts/default?alt=json-in-script&callback=numberOfPosts"></script>
<script src="http://bloggerfaqs.blogspot.com/feeds/comments/default?alt=json-in-script&callback=numberOfComments"></script></font>

____________________________________________________________________________________________________









____________________________________________________________________________________________________
Похожие по тематике статьи :
*

0 коммент.:

Отправить комментарий

Комментировать...