12/28/2005

Get Random Page - Wordpress Plugin

Filed under: — Aviran Mordo

As you know in addition to regular posts in Wordpress, you can also write pages and organize them with your own hierarchy.

You can pages for anything and display it as a regular page like a post or combine it within your template by outputting its content as HTML. Get Random Page does the latter.

This plugin selects a random page from your static pages and outputs its content anywhere in your template.

I use this plugin to rotate ads (see on the top right hand corner), but you can use it for anything you want. For instance you can display a random quote, a random ad, a random tip or anything else you have.

Since pages can be grouped Get Random Page plugin supports groups by specifying 鈥渃hild of鈥?, so you can select a random page from a specific group of pages.

Installation:
Download (.zip) extract and copy the plugin to Wordpress plugin folder and activate it.

After you activate the plugin just use the function get_random_page($child_of) anywhere in your template you want to output a random page.

$child_of is the page ID (number) from which you want to select the random page
If $child_of is not set then it’ll pick a random page from all your pages

For instance: < ?php get_random_page(501) ?> will select and output a random page from all the pages that are children of page id 501

5 Responses to “Get Random Page - Wordpress Plugin”

  1. Feaverish Says:

    This plugin is just what I’m looking for, but I have a question: Is there any way for the plugin to output more than just the text in the page content? It seems to strip out everything but the text in the content of the page, so for instance the page title, paragraph breaks, etc. are removed.

    I’m trying to use it to display a random page on a site’s homepage, but I want the random page to look just like a regular page, with a regular heading and paragraph breaks.

  2. Jos Says:

    I have the same problem… no answer since 2006, so I write a comment with a desesperate feeling.

  3. Aviran Mordo Says:

    This plugin is not intended to do that, and unfortunately I do not have time to make any changes to it.

  4. Kredit Says:

    I have this site bookmarked. Thanks from Kredit

  5. Toushay Says:

    Thanks for this plugin. I have this site bookmarked too.
    Can’t wait to try it out.

Leave a Reply

You must have Javascript enabled in order to submit comments.

All fields are optional (except comment).
Some comments may be held for moderation (depends on spam filter) and not show up immediately.
Links will automatically get rel="nofollow" attribute to deter spammers.

Powered by WordPress