• Adsense
  • Blogger
  • WordPress
  • Social Media
  • SEO
  • Tips
  • Offbeat
Reading: How to add Simple Random Post Widget For Blogger
Share
BlogbeastBlogbeast
Aa
Search
  • Adsense
  • Blogger
  • WordPress
  • Social Media
  • SEO
  • Tips
  • Offbeat
Copyright © 2023 BlogBeast. All Rights Reserved.
bloggerjavascriptwidgets

How to add Simple Random Post Widget For Blogger

admin By admin 08/27/2022 2 Min Read
SHARE

How to install a simple Random post widget on blogger blog – In my previous article, I already described the importance of the Random Post widget. You can read that article here – “Dynamic Random post widget for blogger”. So let’s move on the main topic because I’m not going to waste your time by writing boring things over here.

Before you add this simple random post on your blog, make sure to take a look of this widget by clicking on the below demo button.

After watching the demo of this widget, if you agree with it and want to install this widget, then follow the below simple steps.

At the first, visit to your blogger dashboard, Go to the “Layout” section.

Select “Add a gadget”, Choose Html/JavaScript from the popup menu.

Copy the below Html code and paste it in Html/JavaScript Box.

<ul id="random-posts"></ul>
<style scoped="" type="text/css">
#random-posts{list-style:none;margin:0;padding:0}
#random-posts li{padding:0 0 5px 0;font-size:90%;margin:5px 0;border-bottom:1px solid rgba(0,0,0,0.1)}
#random-posts li a{color:#333;font-size:12px;}
#random-posts li a:hover{color:#e73138;}
</style>
<script type='text/javascript'>
//<![CDATA[
var homePage = "ur_blog_url_here",
numPosts = 8;
function randomPosts(a){if(document.getElementById("random-posts")){var e=shuffleArray(a.feed.entry),title,link,img,content="",ct=document.getElementById("random-posts");for(var i=0;i<numPosts;i++){for(var j=0;j<numPosts;j++){if(e[i].link[j].rel=="alternate"){link=e[i].link[j].href;break}}var title=e[i].title.$t;content+='<strong><li class="random-posts"><a href="'+link+'" title="'+title+'" target="_blank">'+title+'</a></li></strong>'}ct.innerHTML=content}}function shuffleArray(arr){var i=arr.length,j,temp;if(i===0)return false;while(--i){j=Math.floor(Math.random()*(i+1));temp=arr[i];arr[i]=arr[j];arr[j]=temp}return arr}var random_post=document.createElement('script');random_post.src=homePage+'/feeds/posts/summary?alt=json-in-script&orderby=published&max-results=999&callback=randomPosts';document.getElementsByTagName('head')[0].appendChild(random_post);
//]]>
</script>

Replace the above-highlighted URL with your own blog URL.

After that, save the widget, refresh your blog and see the magic.

You Might Also Like

How to make a Biolink for Instagram on Blogger

How to add a cookie consent notification to Blogger

Difference between Blogger and WordPress | Best blogging platform in 2022

How To make your blogger theme responsive

How to Add Simple Stylish Recent Posts Widget For Blogger

Share this Article
Facebook Twitter Copy Link Print
By admin
Follow:
Success is no accident. It is hard work, perseverance, learning, studying, sacrifice and most of all, love of what you are doing or learning to do.
Previous Article How to Add Links To Detect Adblock On Blogger Blog Using JavaScript
Next Article How To Display Estimated Post Reading Time On Blogger
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

235.3k Followers Like
69.1k Followers Follow
56.4k Followers Follow
136k Subscribers Subscribe

Latest News

What is blogging and how to make money from it?
What is blogging and how to make money from it?
How To Make Money from Blogging
8 Fastest ways on How To Make Money from Blogging
What is wordpress plugin
20 Best WordPress Plugins for your Websites in 2022
How to Uninstall Wordpress Plugins manually
How to Uninstall WordPress Plugins completely with Shortcode

You Might Also Like

How to make a BioLink for Instagram in Blogger
blogger

How to make a Biolink for Instagram on Blogger

4 Min Read
bloggerwidgets

How to add a cookie consent notification to Blogger

4 Min Read
bloggerwordpress

Difference between Blogger and WordPress | Best blogging platform in 2022

9 Min Read
bloggertips

How To make your blogger theme responsive

4 Min Read

Always Stay Up to Date

Follow our Facebook to get our newest articles instantly!

We provide tips, tricks, and advice for improving websites and doing better search.

Quick Links

  • About
  • Disclaimer
  • Privacy Policy
  • Write for us

Resouce

  • About
  • Disclaimer
  • Privacy Policy
  • Write for us

Get the Top 10 in Search!

Looking for a trustworthy service to optimize the company website?
Request a Quote

Removed from reading list

Undo
Welcome Back!

Sign in to your account

Lost your password?