Blogging Tips / Images and Media / WordPress Widgets / Tips /

WordPress: Create a random post icon

wordpress icon

Click for random post

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 ?random to the end of your 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=””>Click to read a random post</a>

Example 3 linked to an image:

Draft post

  1. Create a draft post that you will later delete.
  2. Select a small image to link to and upload it into your Media Library.
  3. Fill in the Alternate Text.
  4. Type “Click for random post” into the Caption.
  5. Fill in the Description.
  6. Hover over “Blog Info” on the Admin bar and a dropdown menu will appear.
  7. Hover over “Random Post” and copy the URL onto your clipboard.
  8. Paste that URL into Link URL
  9. 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.
  10. Switch to the HTML editor and copy the image code provided there onto your clipboard.

wordpress image detail box

Text Widget

  1. 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.
  2. Paste the code you copied out if the HTML editor into it.
  3. Click “Save” and “Close
  4. View the front of your blog. Click your image and view a random post.
  5. Delete the draft post as you are done.

34 thoughts on “WordPress: Create a random post icon

  1. Hey timethief, I have just discovered another way to find a random post (I don’t know if it’s new, but I just figured it out ;))

    1… As you say above, hover over Random Post and copy the link url into the clipboard.
    2… Create a new post and write a little message then highlight it and use the make link button in the edit screen and paste the url in there.
    3… Make the post sticky and away you go.
    4… Here’s mine
    5… :)

  2. hey, timethief!
    I’ve tried this random post icon on my page and it is fun, but now it seems that everytime we click it only redirects to pages like about, archive, menu, etc. instead of a proper content page. Is there any way I can avoid that?

  3. Cool idea. Read it. Re-read it. Got it. Did it. Neat. Thanks.
    PS – Love WP help – and appreciate your contribution (run across it often). Thanks again!

  4. The ?random link can also be put into a menu, as a custom link, and thereby included in the navigation bar. Some readers really enjoy exploring sites that way.

    • Hi Zeenat
      I adore the image you used. It’s perfect for your blog. I clicked it and read your post on gratitude. I need a reminder so I’m glad I tried it out.
      ♥ TiTi

  5. HI TiTi,
    This is such a neat idea! I might just give it a go…I love adding useful widgets to the blog :)
    I’ll come back and tell you when I add it… :)
    Love and hugs,

    • Hi Sophie,
      You’re welcome. As you have a food blog you may want to use a small “foodie” image. :)

      I’ll pop in and see what you created later. :)

Comments are closed.