Create a Link to Randomly view Posts

This tutorial will help you build or create a link and give a random posts when clicked. I think it will help most  if your blog is for "entertainment" like this one.

First. So let's start by going from Dashboard > Template > Edit HTML then find  </head> and paste this code above it.

Second. Then include the short script, ignore if you have it already.
 <script src='http://code.jquery.com/jquery-latest.js'/>
Lastly. You can post this link anywhere you want as long as it appears. :P
 <a href='#random' onclick='feelingLucky()' title='Random Post'>Random Posts</a>
 Replaced the blue words as you desire.


Bonus. Actually you can assign a keyboard event that will "click" the link when pressed.

 
Paste the code above the </body> tag, then change the link to this,
<a href='#random' id='randomp' onclick='feelingLucky()' title='Random Post'>Random Posts</a>
When you press CTRL on keyboard, it will give you the random posts. List of keyboard events here.
Change the "17" in the script to your own keyboard value.
That's it!

Popular posts from this blog

Add/Subtract Single Digit Number in Assembly Language

Set table width to 100% on PDF export in Datatables