Forums

Problem with the Page Navigation and randomizing posts. (2 posts)

  1. Maaxie
    Member
    Posted 2 years ago #

    Hello.

    As the topic tells I have a problem with the posts when it comes to the navigation system.

    My site shows 10 posts per page. I use <?php query_posts('orderby=rand'); ?> to show all my posts in a random order.

    Here's the problem; when I want to go to the second or any other page the posts are randomized again. Which means that posts that were shown on the first page appears on the next page etc. This is not what I want.

    What I need is a code or something that remembers the randomizing from the first time to show on the 2nd and 3rd page etc.

    I appreciate all help I can get.

    Maaxie

  2. alchymyth
    The Sweeper
    Posted 2 years ago #

    try and replace:
    <?php query_posts('orderby=rand'); ?>

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($query_string.'&orderby=rand&paged=',$paged); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic