Blogger Tips And Tricks: Part - 2
Yo there! If you are new here, you may want to subscribe to my RSS feed, or through email, for more tips on better and effective blogging!
By Rajeev Edmonds from MintBlogger
In this second part of this series [here's Part 1], we will look at some useful and easy tricks for Blogger blogs. By default, the Blogger platform provides countless widgets, gadgets and services that are great add-ons for our blog. Still, sometimes we want to show custom data and statistics on our blog. With some simple coding and tweaking some settings we can add these little gems to our blog to make it look more professional and a better experience for our readers.
Show Total Posts and Comments On Blogger Blog
If you want to show the total number of posts and comments on your blog, this simple JavaScript code can do the work.
function numberOfPosts(json) {
document.write(’Total Posts: ‘ + json.feed.openSearch$totalResults.$t + ‘<br>’);
}
function numberOfComments(json) {
document.write(’Total Comments: ‘ + json.feed.openSearch$totalResults.$t + ‘<br>’);
}
</script>
<script src=”http://your-blog-url-here.com/feeds/posts/default?alt=json-in-script&callback=numberOfPosts”></script><script src=”http://your-blog-url-here.com/feeds/comments/default?alt=json-in-script&callback=numberOfComments”></script>
The result looks like this:
Total Comments: 289
To show these stats in the sidebar, simply create and new ‘JavaScript/HTML’ gadget from ‘Layout’ section and paste the above code. You can also beautify it using CSS to gel it well with your blog’s theme.
Disable Comments On Any Post
Although this option is easily accessible, but a large number of Blogger users are unaware of it. To disable comments on any post, go to post editor and click the ‘Post Options’ link at bottom right of the editor:
Choose the ‘Don’t Allow’ for ‘Readers Comments’ option and that’s it. You can again enable or disable the comments of any old Blogger post without any restrictions. You can use this option to disable comments on the About, Contact, Advertise and similar pages too.
Disable Ads On Archive Pages
If you want your AdSense ads to be displayed only on individual post pages, wrap your ad code around the following code:
/* Place Your Ad Code Here */
</b:if>
The if condition checks whether the page is a post page or not. In case it’s not a post page, the conditions evaluates to false and the ad code is not executed.
In next part of this series we will see how to display different set of ads on home page and on individual post pages.
Your Thoughts?
How do you think the series is going on so far? Is it helpful? Please do share your opinion with us
Rajeev Edmonds blogs at MintBlogger, a blog about social media and blogging tips
If you liked this post, consider subscribing to the RSS feed (what's RSS?) to get updates on new blog posts.











Has not working on my Blog, and i tested in my other Blogs too..
Do you have any idea why?
Thank you
Nick
i’m talkink about the script for “Show Total Posts and Comments On Blogger Blog”
Hi AATON,
Can you please tell me what error message is coming and where you are pasting it?
Hi Rajeev
I paste the script on my left sidebar with “Add widget –>HTML” comand. But it shows me nothing.
AATON,
Make sure after pasting, replace all instances of ` with ‘
hello … u can help whit something?… i want to delet older post option from my blog. i wana say… i dont want people to be able to go to older post or to new post. i want to use ad gadget for links and people to visit my blog content using only the links and not old/new post. i want to add many flash games so if in every new page from my blog people must download again and again games will be bad. this is the reason. or maybe u give me a solution when some1 use a page from my blog the game to be isolated(to not load or the music to start). only if want to play the game and press on somethin the game to start loading.
Cool. I was trying to figure out how to disable comments on older posts and got some bonus tips as well! Thanx a lot.