Random Post Plugin for WordPress

Couple of days ago, a regular reader Fauzi (aka Cyperhackz) asked me how to show random post on the top of the blog and which plugin I used to do that.

Well there are lots of plugins out there for wordpress which enables you to show random post, but I use Random Posts from WASABI. If you strategically place Random Post on your blog it can be really useful. It gives deeper access for visitors on your blog.

Installation:

This plugin is fairly simple to install, Just download Random Posts Plugin by WASABI. Unzip it and upload it to your /wp-content/plugins directory using your favorite FTP client. Then go to Plugins in your WordPress Admin panel and activate it.

Now Modify this code and add it to your Template

[code lang="php"]< ?php random_posts($limit, $len, $before_title, $after_title, $before_post, $after_post, $show_pass_post, $show_excerpt); ?>[/code]

[code]$limit - No. of posts to show.
$len - Lenght of auto-generate excerpt.
$before_title - Text to appear before the entry title.
$after_title - Text to appear after the entry title.
$befor_post - Text to appear before the entry excerpt.
$after_post - Text to appear after the entry excerpt.
$show_pass_post = Include/exclude password protected entries (Default: false).
$show_excerpt = Show/hide excerpt (Default: false).[/code]

Example: If you wish to show only a single random post (like mine), use the following tag

[code lang="php"]< ?php random_posts(1, 0, '', '', '', '', false, false); ?>[/code]

Download Random Posts Plugin

[tags]Wordpress, Random Posts, Plugins, Blogging[/tags]

This post was published by on August 14, 2006

About the Author: Thilak Rao works as a Social Media Expert. He is one of the first professional bloggers from India, and he loves to write, travel and click photos. Follow him on Twitter @thilak

  • http://www.tech-buzz.net Thilak

    Incase if you want to make your Random Posts look exactly as mine, then add these lines to the end of your style.css

    [code lang="css"]#outerslice {
    background: #ffc;
    border-bottom: 1px solid #fc0;
    margin: 0 0 5px 0;
    padding: 4px 0;
    text-align: center;
    }

    #slice {
    width: 880px;
    margin: 0 auto;
    }[/code]

    And then Add this line Exactly after < body >, in your header.php
    [code lang="php"]


    Random Read: < ?php random_posts(1, 0, '', '', '', '', false, false); ?>

    [/code]

  • http://www.cypherhackz.net CypherHackz

    thanks for the info buddy. this plugin really useful for visitors. thanks again…

  • http://www.tasty.sk Vladi

    Hi, if I wanna include excerpt in random post – I set the option to value “true” ? Because I tried that and see no excerpt.:(

    Any ideas? thanks:)

  • http://tech-buzz.net Thilak

    Vladi: Well, it worked for me. Better ask this question to the author

  • http://www.tech-scope.com fuad

    Thanx thilak. Your post really benifit me. :)

  • http://tech-buzz.net Thilak

    Fuad: No Problem, Keep reading TechBuzz

  • alvin

    hi there,

    im interested in this plugin. im new to wordpress and have no knowledge of php, very little with html and css. what file do i need to edit to put that code. is it the index.php? and do i just put the code in the end of the file?

    thanks!

  • http://www.tuvie.com tuvie

    do you know any plugin that display random image of our post instead of the text post?

  • Eric

    The download URL is dead, as well as the plugin’s site : http://www.w-a-s-a-b-i.com/archives/2004/05/27/wordpress-random-posts-plugin/
    Where can I find this plugin now ?

  • http://www.photricity.com Josh Meyer
  • http://linusov.info/u-par-rijeci/slucajni-odabir/ Slučajni odabir na linus[ov blog].info

    [...] se direktno odlazi na neki post koji možda nije među pet odabranih. Lista se generira pomoću Random Post plugin-a, a link kojim se bira neki slučajni tekst dobiven je s plugin-om Random [...]

  • http://voragine.net/wordpress/lista-de-entradas-aleatorias-de-una-categoria Entradas aleatorias de una categoría en WordPress < voragine bramante

    [...] varios plugins, pero no he conseguido hacer funcionar ninguno. En tech-buzz recomiendan el Random Posts Plugin de Wasabi, pero la página parece estar caída. Una pena, que [...]

  • http://www.salsabeela.com Ollie

    Thanks it’s very useful! I’ve used it in my blog

  • http://www.jcmiras.net Alfie

    It seems that the download page is down.

  • http://www.whathuhstudios.com/press Daniel Costalis

    I found your page while looking for a plugin to show just a single random post. The download link and home page were down… so I kept looking. Didn’t find one. So I made one. Scrap this if you consider it spam, but here you go:
    http://wordpress.org/extend/plugins/single-random-post/

  • http://www.isthisablog.com Daniel Costalis

    This download link is down now. This is a dated post! I have created a plugin inspired by this entry, however. It displays ONLY a single random post. There are many other plugins that display multiple random posts, and they can be found on the wordpress plugins page.

    http://wordpress.org/extend/plugins/single-random-post/

  • http://www.tutorialboard.net Olson Mino

    is there a demo for this plug in?

  • http://tech-buzz.net/ Thilak

    Vladi: Well, it worked for me. Better ask this question to the author

  • http://www.gtricks.com Google Tricks

    Use the following code in theme directly to use randoem post :

    <?php
    $randomPost = $wpdb->get_var(“SELECT guid FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY rand() LIMIT 1″);
    echo 'Random Post';
    ?>

  • http://www.gtricks.com Google Tricks

    Use the following code in theme directly to use randoem post :

    <?php
    $randomPost = $wpdb->get_var(“SELECT guid FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY rand() LIMIT 1″);
    echo 'Random Post';
    ?>