It’s easy to post a link in a text widget in your wordpress blog’s sidebar that when clicked will display a random post found in your blog. But did you know that the random post URL can be linked to an image of your choice?
This post is a step by step tutorial for wordpress beginners. You can use anchor text in your random post widget or not. Simply place the code into a text widget and display it at the top of your blog’s sidebar for reader convenience.
Here’s just a little easter egg for you to play with: Try adding
?randomto the end of your WordPress.com URL and it will redirect you to a random post on your blog. You can link to that address like any other, either in your post or a widget. Update: Based on a suggestion in the comments, I’ve added this to the admin bar so when you’re logged in and you hover over “Blog Info” the first menu item is a random post link. — Get Random
Simply replace example URL with the Random Post link in the choice you make below.
Example 1 link without anchor text:
Example 2 linked to anchor text: Click for random post
<a href=”http://example.wordpress.com/?random”>Click to read a random post</a>
Example 3 linked to an image:
- Create a draft post that you will later delete.
- Select a small image to link to and upload it into your Media Library.
- Fill in the Alternate Text.
- Type “Click for random post” into the Caption.
- Fill in the Description.
- Hover over “Blog Info” on the Admin bar and a dropdown menu will appear.
- Hover over “Random Post” and copy the URL onto your clipboard.
- Paste that URL into Link URL
- Click the “Insert into post” button and when that it complete click the X to close the image details box and return to your draft post.
- Switch to the HTML editor and copy the image code provided there onto your clipboard.
- Proceed to Appearance > Widgets select a text widget and drag and drop it into the position in your sidebar that you want it to appear in and open the widget.
- Paste the code you copied out if the HTML editor into it.
- Click “Save” and “Close“
- View the front of your blog. Click your image and view a random post.
- Delete the draft post as you are done.