WordPress.org

Ready to get started?Download WordPress

Forums

How to remove pagination from search.php template (3 posts)

  1. marc0047
    Member
    Posted 5 years ago #

    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?

  2. jfsimard
    Member
    Posted 5 years ago #

    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?

  3. jfsimard
    Member
    Posted 5 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic