Support » Plugins and Hacks » Create a page that has a random post in it?

  • How do I do this? I want a whole new page that will display a random post.

    Is there a plugin of the sort?

Viewing 3 replies - 1 through 3 (of 3 total)
  • <?php
    
    //The Query
    
    query_posts('showposts=1&orderby=rand');
    
    if ( have_posts() ) : while ( have_posts() ) : the_post();
    
    endwhile; else:
    
    endif;
    
    //Reset Query
    wp_reset_query();
    
    ?>

    Thanks. However that looks like a foreign language to me.

    Where do I put that code? Do I create a page and put it in the HTML view?

    you need to edit the theme template, probably the page.php file, you’ll also need to set up a custom page template. Just google these terms, it sounds complicated but it’s really quite easy.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create a page that has a random post in it?’ is closed to new replies.