Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hi,

    I had a very similar problem, in that I wanted to have my index and archive pages show only one post per page, but I wanted all of my search results to show up on one page. After a lot of failure and searching, I found the solution in somebody else’s problem:

    Instead of changing the search form, your client can change the search results page. Just before the Loop, add the following code:

    <?php
    $wp_query->query_vars[“posts_per_page”] = 5;
    $wp_query->get_posts();
    ?>

    My own problem was that I was using <?php query_posts(“posts_per_page=5”); ?>. As the user on the other topic explains, using query_posts() restarts the query, whereas the other method above merely adds the post_per_page variable to the existing query (which is a search query in the case of the search results page).

    I hope this helps!

Viewing 1 replies (of 1 total)