Tuesday, September 8, 2009

Popular Posts Widget For Blogger - New and Working

The previous widget for showing Popular posts (most commented), has been stopped working, so here's a new code for the widget.

Steps to follow:

Log in to Blogger
Go to Layout -> Add a Gadget -> HTML/JavaScript

Now copy and paste this code in to the widget:
<script type="text/javascript">
function pipeCallback(obj) {
document.write('');
}


http://bloggerstop.net" target="_blank">Popular Posts Widget

NOTE: REPLACE everything in RED color in the code above with your blog's address without typing http://

The above code displays 10 posts, you can change it by editing the number being displayed in blue !

The above widget code, displays the links/titles like this:

Post one (18)
Post two (14) etc.

If you want to display them like this:

Post one (18 comments)
Post two (14 comments),

then use this code :
<script type="text/javascript">
function pipeCallback(obj) {
document.write('
    ');
    var i;
    for (i = 0; i < href = "'" item =" ">" + "" + obj.value.items[i].title + " ";
    document.write(item);
    }
    document.write('
');

}


Widget by http://www.bloggerstop.net">Blogger Widgets

And in case, you want to display the popular posts without the number of comments (as requested by Ben), use this code
<script type="text/javascript">
function pipeCallback(obj) {
document.write('
    ');
    var i;
    for (i = 0; i < href = "'" item =" ">" + "" + obj.value.items[i].title + " ";
    document.write(item);
    }
    document.write('
');

}


Widget by http://www.bloggerstop.net">Blogger Widgets

P.S. : Please do not remove the footer link...

0 comments:

Post a Comment