Headlines News :
Home » , » Show random posts In blog

Show random posts In blog

Written By BlogKing on Monday, February 27, 2012 | 11:22 AM

Random Posts Widget For Blogger means that every refreshing of page widgets change posts lists,This widget selects the posts randomly from all from your blog posts, it pick from your blog to show randomly from your blog posts

Here is setup to install this widgets
1. Log into Blogger >> Layout >> Html/Javascript .
2.now past below code


<script type="text/javascript">
var randarray = new Array();var l=0;var flag;
var numofpost=6;function randomposts(json){
var total = parseInt(json.feed.openSearch$totalResults.$t,10);
for(i=0;i < numofpost;){flag=0;randarray.length=numofpost;l=Math.floor(Math.random()*total);for(j in randarray){if(l==randarray[j]){ flag=1;}}
if(flag==0&&l!=0){randarray[i++]=l;}}document.write('<ul>');
for(n in randarray){ var p=randarray[n];var entry=json.feed.entry[p-1];
for(k=0; k < entry.link.length; k++){if(entry.link[k].rel=='alternate'){var item = "<li>" + "<a href=" + entry.link[k].href + ">" + entry.title.$t + "</a> </li>";
document.write(item);}}
}document.write('</ul>');}
</script>
<script src="/feeds/posts/default?alt=json-in-script&start-index=1&max-results=1000&callback=randomposts" type="text/javascript"></script>


Change the the text no in red above in codes to select how many random posts you want to display.

And Save the Widget.Now you will be shown up the the title of the posts in widget all the posts will be picked randomly.

Now How to show random posts title with post summary.

Just open this script or download this Random Post Script.

Either host it to your server or use this script only.

You can get Free File Host Here.

1. Log into Blogger >> Layout >> Html/Javascript .
2.now paste this code in it.

<script type="text/javascript">
var randarray = new Array();var l=0;var flag;
var numofpost=5;var wordnumber=5;</script>
<script style="text/javascript" src="http://btemplatescripts.googlecode.com/files/random-posts-with-summary.js">
</script>
<script src="/feeds/posts/default?alt=json-in-script&start-index=1&max-results=1000&callback=randomposts" type="text/javascript"></script>


Just change the green url with your script url which you uploaded to your server,if you want.
Share this article :

No comments:

Post a Comment

 
Support : Creating Website | Adult Dating | | Johny Portal | Magazine Templates | Mp3 Sonhs Download |
Copyright © 2011. Blogger Free Tricks - All Rights Reserved
Template Modify by Myblogtriks Inspired Wordpress Hack
Proudly powered by My Blog Tricks