Forums

[resolved] How do you choose the no. of posts displayed in search results? (5 posts)

  1. SteveDrum
    Member
    Posted 3 years ago #

    I've got a niggly little problem... hoping you might be able to help me.

    My blog is set up to display the last seven posts. And when someone does a search, that brings up seven posts as well. In fact, even when they choose to browse a category, it still only brings up the first seven posts.
    And here is my problem... I have only chosen to display an 'extract' on the search results and archive pages, rather then the entire posts. Resulting in a very short page of search results. (I basically just get seven titles and seven extracts.)

    Is there any way to increase the number of posts displayed on the search results and archive pages, without adjusting the number of posts displayed on the front page?

  2. Michael Fields
    Theme Wrangler
    Posted 3 years ago #

    Have you tried to use the query_posts() function before your loop in your theme's search.php file?

    The documentation is here:
    http://codex.wordpress.org/Template_Tags/query_posts

    You should be able to use something like this before your loop:

    <?php query_posts('showposts=20'); ?>

  3. @mercime
    Member
    Posted 3 years ago #

  4. SteveDrum
    Member
    Posted 3 years ago #

    i went with the code rather than the plugin -- thanks mfields. as easy as that! it only took five seconds

  5. Michael Fields
    Theme Wrangler
    Posted 3 years ago #

    Steve,
    Glad it helped you!
    Plugin does look nice.
    Will download and check it out.

Topic Closed

This topic has been closed to new replies.

About this Topic