WordPress.org

Ready to get started?Download WordPress

Forums

random post upon link (2 posts)

  1. Mark Jaquith
    WordPress Lead Dev
    Posted 9 years ago #

    You could create a variable, maybe called "random_posts."
    Create a link to http://yoursite.com/?random_posts=true
    In your index.php file, you can check to see if random_posts is set like so:
    <?php if ($_GET['random_posts']) {
    showRandomPostsThingie();
    } ?>

    obviously, you'd want to integrate this into the "if ($posts)" conditional, so that only the random posts would be shown.
    That should give you the general idea of how to do it.

  2. alicson
    Member
    Posted 9 years ago #

    thank you for that, mark..
    i played around with your suggestion for a while.. it looks completely correct and useful--if only i knew the proper syntax to make the rest of the wordpress php code mix in with it. but i guess i'll learn/figure that out eventually...
    i've realized:

    • i'm really going to have to learn php sooner than later to do what i'd like to do with wordpress
    • while Alex's plugin is great, i'm looking for something that can reproduce the entire post--author and all... so probably something that can return an entire container/div-enclosed section/include of all the pieces that make up the view of "one post" (author, permalink, date, title, content, comment-link, etc.)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.