Home » » How To Make Random Post Only Title In Blog

How To Make Random Post Only Title In Blog

Posted by Ran Dreamer on 23 Apr 2015

Make Random Post In Blog - There are different kinds of widgets random post on the blog, there were accompanied by pictures and some are just the title alone, but it's up to you to choose which, if you want to give priority to your blog loading speed so as not to slow then you should use a random post without pictures alone. Read : How to Speed Up Loading Blog up to 90%
Random Post

Tutorial Make Random Post Only Title

Login to your blogger
Go to Layout => add widget => Html / Javascript
then copy and paste the code below aliens in the html column
<script type="text/javascript"> 
var randarray = new Array();var l=0;var flag; var numofpost=5;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&amp;start-index=1&amp;max-results=300&amp;callback=randomposts" type="text/javascript">
Widgets random post above only display 5 articles at random, if you want to increase or decrease
please change numofpost = 5 the number that you want to show
And finally, please save the template and see the results.
Read How To Create A Sitemap And How To Submit A Sitemap In Google Webmaster

Share This Post :
Copyright © 2015 LABSTON | Adsense, Blogger, Android, Backlink, SEO, Template. All Rights Reserved
Template Johny Wuss Responsive by Creating Website and CB Design