Create a Stumbleupon Like Random Post Page in WordPress
Do you want to have a Stumbleupon like Browsing page or random post page in wordpress? In this post we will show you how to create a page that displays a random post in WordPress. You can send visitors to that page and they can read a new post every time they refresh the page.
1. Create a custom page template in WordPress.
2. Add the following code in your custom page template:
- <?php query_posts(array(‘orderby’ => ‘rand’, ‘showposts’ => 1));
- if (have_posts()) :
- while (have_posts()) : the_post();
- // WordPress loop
- endwhile;
- endif; ?>
Once you saved it and uploaded the file, you can view this random post.