Support » Plugins » Randomizing posts without dupicating on next page?

  • Hi folks,

    I am working on a theme that requires randomizing the order of the loop display in categories. This is the code that I am using, which works, but when I move to the next or previous page, duplicates are displayed.

    query_posts($query_string . '&orderby=rand');
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    I am hoping that someone here has worked through this same issue and might offer some advise.


Viewing 7 replies - 1 through 7 (of 7 total)
  • I’m bumping this question because all my efforts today have not resulted in an resolution. It seems as though the code I am currently using is querying random posts both on the first archive page and then again(a new query) on the previous-next page(s). Some posts are displayed twice, and others never at all. What I need is for the entire category to be queried, that list of post randomized, then displayed on the front page and following pages.

    Any advise would be great. This one has me totally baffled.

    Thanks again

    I am still trying to resolve this issue. Very frustrating.

    I’ve tried adding the orderby=rand parameter to the archive.php loop in every way I can find. So far nothing has worked quite right. I am bumping this post one last time in hopes that someone has experience with this issue.

    Thanks ahead of time!

    Please paste all the code from the theme template files (probably index.php and category.php) that is displaying those posts into a pastebin, such as, and report the link(s) back here. Maybe someone might spot your problem. Thanks.

    Also provide a link to see the problem and point out which are duplicate posts.

    I believe the issue is with my coding on the archive page, here is the link to that in a pastebin.

    The loop begins about halfway down the page.

    Thanks for looking!

    not sure what this does:

    <?php include(TEMPLATEPATH."/sidebarhome.php");?>

    but your logic looks okay to me…

    Might try echo "<pre>"; print_r($wp_query); echo "</pre>"; before query to see if you see anything…don’t have much else…sorry.

    Michael thanks for looking.

    I’ll keep messing around with it, and try your suggestions.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Randomizing posts without dupicating on next page?’ is closed to new replies.