Friday, April 15, 2011

Blogger- Display popular posts based on comments!

1) Create a new page or a new gadget in the sidebar.
2) Add the following code in Edit HTML mode.
3) Replace your blog address instead of URL
4) Click publish post. Done!



<!-- Popular posts with comment count Start -->
<script type="text/javascript">
function getYpipePP(feed) {
 document.write('<ol style="">');
 var i;
 for (i = 0; i < feed.count ; i++)
 {
var href = "'" + feed.value.items[i].link + "'";
var pTitle = feed.value.items[i].title;
var pComment = " \(" + feed.value.items[i].commentcount + "\)";
var pList = "<li>" + "<a href="+ href + '" target="_blank">' + pTitle;
 document.write(pList);
 document.write(pComment); //to remove comment count delete this line
 document.write('</a></li>');
 }
 document.write('</ol>');
 }
 </script>
 <script src="http://pipes.yahoo.com/pipes/pipe.run?
 YourBlogUrl=http://www.bloggersentral.com
 &ShowHowMany=10
 &_id=390e906036f48772b2ed4b5d837af4cd
 &_callback=getYpipePP
 &_render=json" 
type="text/javascript"></script>
<span style="font-size: 80%; float:right;"><a href="http://www.bloggersentral.com/2010/04/popular-most-commented-posts-widget.html" target="_blank">Make your own</a></span>
<!-- Popular posts with comment count End -->

No comments:

Post a Comment