Support » Fixing WordPress » How to remove pagination from search.php template

  • I’m trying to create a search output page with search.php where there is no pagination. I thought the following would work, but what it does is pull up all posts with any query input.

    <?php query_posts('posts_per_page=-1'); while (have_posts()) : the_post(); ?>
    [do stuff]
    <?php endwhile; ?>

    Anyone know the solution or how a good article to point me to?

Viewing 2 replies - 1 through 2 (of 2 total)
  • That is almost exactly what I am trying to do with my monthly archive page. I am using:
    <?php query_posts($query_string . “&posts_per_page=-1”) ?>
    so it does not affect the rest of the query string –
    http://codex.wordpress.org/Template_Tags/query_posts

    I am still getting the pagination though. How can we remove pagination with the same query? Is there a parameter that will do it?

    Update: It seems to remove pagination since both the next_posts_link and prev_posts_link are not printed.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to remove pagination from search.php template’ is closed to new replies.