Add Popular Post Widget to blogger/Blogspot blog

Many Blogger wants to show their visitor Most popular post in single place.Here is a very simple method to add Popular post widget in blogger blog.
This widget based on the number of comments each post gets so the most commented post will be the most popular post .




How To Add Popular post Widget to blogger/Blogspot Blog




Its a very easy method to add popular post in blogger blog just Follow some easy steps.


  • Go to Layout--->Add a gadget--->Html/Java script 
  • Write any Title like Popular post/Most commented post or whatever you want 
  • Now Copy and paste this code below full code
<script language='javascript'>
aBold = true;
numposts=200;
maxshowresult=7;
home_page = "http://bloggerlike.blogspot.com/";
</script>
<script type='text/javascript'>
//<![CDATA[
var postTitlear=new Array();var postUrlar=new Array();var postCommentar=new Array();var totalpost;document.write("<ul>");function showrecentposts(j){var a=j.feed.entry.length;totalpost=a;for(var f=0;f<a;f  ){var h=j.feed.entry[f];var c=h.title.$t;var b;var g;if(f==j.feed.entry.length){break}for(var d=0;d<h.link.length;d  ){if(h.link[d].rel=="alternate"){g=h.link[d].href;break}}for(var d=0;d<h.link.length;d  ){if(h.link[d].rel=="replies"&&h.link[d].type=="text/html"){b=h.link[d].title.split(" ")[0];break}}c=(aBold)?"<b>" c "</b>":c;postTitlear.push(c);postUrlar.push(g);postCommentar.push(b)}sortPosts();for(var f=0;f<maxshowresult;f  ){var e='<li><a href="' postUrlar[f] '" class="recent-link">' postTitlear[f] " (" postCommentar[f] " comments)</a>";document.write(e)}}function sortPosts(){function c(d,f){var e=postTitlear[d];postTitlear[d]=postTitlear[f];postTitlear[f]=e;var e=postUrlar[d];postUrlar[d]=postUrlar[f];postUrlar[f]=e;var e=postCommentar[d];postCommentar[d]=postCommentar[f];postCommentar[f]=e}for(var b=0;b<postTitlear.length-1;b  ){for(var a=b 1;a<postTitlear.length;a  ){if(parseInt(postCommentar[b])<parseInt(postCommentar[a])){c(b,a)}}}}document.write('<script src="' home_page "feeds/posts/default?max-results=" numposts '&orderby=published&alt=json-in-script&callback=showrecentposts"><\/script>');
//]]>
</script>

  • Customize this widget like this 
*Change My blog address with your address (Red Text)
*Numpost : how many post that count 
*Maxshowresult: Number of posts you want to show

Try it and share your experience with me .


0 comments to "Add Popular Post Widget to blogger/Blogspot blog"

Post a Comment

Find Us on FaceBook

All Category

Followers

Web hosting for webmasters