• Resolved dsortax

    (@dsortax)


    Hello, I want to know if it’s possible to make the posts appear randomly each time refreshing the page of my website. They appear by date for now.

    I use ThreatToCreativity 2.3 by Max is NOW! and WordPress 2.9.1

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You can have posts displayed randomly by using the ‘orderby=rand’ argument to query_posts as described in the Codex here.

    Thread Starter dsortax

    (@dsortax)

    oK I will try thanks!

    Edit: It looks a bit complicated for me lol Do you know the code?

    Where can I find the right place to put the code in?

    Thread Starter dsortax

    (@dsortax)

    <?php query_posts('orderby=rand'); ?>

    I can’t make it to work… Someone knows where i have to put that code in?

    In index.php, change this:

    <!-- <div id="fun"></div> -->
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    to this:

    <!-- <div id="fun"></div> -->
    <?php global $wp_query;
    query_posts(
       array_merge(
          $wp_query->query,
          array('orderby' => 'rand')
       )
    );?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    Thread Starter dsortax

    (@dsortax)

    Alright thanks alot I will try it ??

    Edit: It works very well thanks alot for the help I really apreciate it ??

    Im so happy ??

    You are welcome!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to make the posts random at refresh page?’ is closed to new replies.