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:

  1. <?php query_posts(array(‘orderby’ => ‘rand’, ‘showposts’ => 1));   
  2. if (have_posts()) :   
  3.      while (have_posts()) : the_post();    
  4.          // WordPress loop   
  5.      endwhile;   
  6. endif; ?>   

Once you saved it and uploaded the file, you can view this random post.

See also  20+ Amazing Angelina Jolie Tattoos Pictures

Leave a Reply

Your email address will not be published. Required fields are marked *