Forums

[resolved] search.php - displaying results without pagination (5 posts)

  1. Qbs
    Member
    Posted 2 years ago #

    in my admin panel I've set WP to display 3 posts per page and it works but I've noticed that this also influences the number of search results...

    I'd like all of my search results to be displayed on one single page, how do I do that?

    I reckon that the easiest way would be to change $posts_per_page; but I can't figure out ho to change it just for the search.php template

    I've also found something like <?php query_posts('posts_per_page=-1&post_type=post'); ?>
    but for the love of god I can't make it show ONLY the search results

    help...

  2. lhoylhoy
    Member
    Posted 2 years ago #

    I have exactly the same problem! help!

  3. cg219
    Member
    Posted 2 years ago #

    Hey poster, this should help

    <?php query_posts("$query_string . '&posts_per_page=-1'"); ?>

    Put that right before your loop. $query_string holds whatever the current query is. In this case it is your search.

    Good Luck =D

  4. Qbs
    Member
    Posted 2 years ago #

    cg219: THANKS!!!!!!!!!!!!!!!!!!! :)

  5. mariostella
    Member
    Posted 1 year ago #

    @cg219
    Thanks that worked great! I have no idea why but I only showed 10 posts although counted many more found. Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Topic