How to Create a Page that Displays Random Posts
The dynamic ability of WordPress is one feature that impresses the most.
To create a page that displays random posts, create a custom page template and post the code below where you want the random posts to display:
<?php
query_posts(array(‘orderby’ => ‘rand’, ‘showposts’ => 1));
if (have_posts()) :
while (have_posts()) : the_post(); ?>
<h1><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></h1>
<?php the_content(); ?>
<?php endwhile;
endif; ?>
What this does:
‘orderby’ => ‘rand’ – Load these posts in a random order.
‘showposts’ => 1 – Only show 1 post at a time.
You can change the number to what you want but most people tend to keep the number low.
WordPress support
Wordpress Themes & plugins
WordPress Books
- WordPress Search Engine Success: How To Maximize SEO & Income From WordPress Websites
- Blogging with Word Press ,WordPress is a free web based software program.
- The Monster Archive of Blogging Advice Reviews
- WordPress Secrets (The Jason Fladlien Internet Marketing Reports) Reviews
- WordPress for Web Designers
- Smashing HTML 5 (Smashing Magazine Book Series) Reviews
- WordPress 3 Ultimate Security Reviews
- Your own WordPress Blog
- WordPress Video Training CD Easy to Follow (A practical way to master WordPress)
- All About Blogging
- The $100k+ Blogging Formula
- How To Use Google To Steal a Slice of Amazons Profits (Amazon Blog Riches)
- 6 Building Blocks For Crafting A Perfect Press Release
- WordPress 24-Hour Trainer: Watch, Read, and Learn How to Create and Customize WordPress Sites (Book & DVD) Reviews
- Introducing Human Geographies (Hodder Arnold Publication)






