Alan Edwardes

Random Redirect With Pretty URLs And WordPress 2.5

I didn't realise that upgrading WordPress would break the pretty random redirect plugin that I modified, but it was brought to my attention today that it did. So, I set about trying to fix it.

The solution I came up with was to create a page with the permalink "/random/", so that I could apply a page template to it.

Grab my page template: Source, ZIP. Upload it to your active theme directory.

Now you need to create a page called Random. You can fill it with any text you want, because no-one will see it anyway.

WordPress Page Template

At the bottom of the WordPress edit page panel, under Advanced Options, select the random redirect page template.

You now have a fully functional /random/ page that will redirect you to a random post on your site when someone visits it, and the page will show up on any page lists you have on your theme, meaning you don't have to manually add the link.

Now wasn't that easy?

30th of March 2008 at 12:13 PM

4 years, 1 month ago

written by Alan Edwardes.

175 words

rand: Google Reader Next Link: The ...

next: Window Clippings; It's Like Skitch ...

prev: WordPress 2.5 Rocks So Much ...

share:FacebookTwitterRedditdiggStumbleUpondeliciousHacker NewsLinkedIn

Add a Comment

© 2006 – 2012 Alan Edwardes / code on github
Top