Support » Fixing WordPress » Trouble with query_posts

  • I’m working on a custom theme, and want to generate archive pages showing all entries for the selected time period or category one one page, no pagination. The codex helpfully provides this code sample:

    <?php
    query_posts($query_string.'posts_per_page=-1');
    while(have_posts()) { the_post();
    <!-- put your loop here -->
    }
    ?>

    This is not working according to plan. Date archives behave as before: paginated. Category archives (which are generated from the same template) do not produce any output for the loop. I’ve even borrowed the “archive.php” file from the default template, added the line query_posts($query_string.'posts_per_page=-1'); to it, and gotten the same results.

    thanks in advance for any help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter adamrice

    (@adamrice)

    bump

    It seems the documentation on the query_posts page regarding using $query_string is incomplete. I’m doing something similar to what you’re doing and after several unsuccessful attempts, I tried simply printing out the $query_string variable to see what was in it and it’s either empty or it doesn’t exist.

    The following code produces no output:

    <?php
    echo $query_string;
    print_r($query_string);
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trouble with query_posts’ is closed to new replies.