WordPress.org

Ready to get started?Download WordPress

Forums

increase search result (4 posts)

  1. dazbobaby
    Member
    Posted 4 years ago #

    I'd like to see more search results.
    Currently the results page shows only 2, thats because my settings for reading is only 2 posts.
    So please make a seperate section for search results, so people can see more without clicking older posts.

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    This is not a WordPress issue but a theme problem. Try adding next and previous pagination to your theme's search template file.

  3. dazbobaby
    Member
    Posted 4 years ago #

    It's not a theme problem esmi, the theme does have a previous and next button.
    What is needed is a search function that shows more results based on a set number of results and not a set number of blog posts shown on the front page.

    If there are coding tweaks that need to be done, mind, I'd just like to be shown how.

  4. dazbobaby
    Member
    Posted 4 years ago #

    I found the answer, and it works brilliantly.
    http://www.artiss.co.uk/2009/02/improving-wordpress-search

    Increasing the number of Search Results Per Page

    The one problem with summarising your search results is that the blogs are a lot smaller on the page. WordPress only gives you one place to specify the number of posts per page and this applies to all forms of output – this means that the summarised results will take up a lot less of the page and, if there’s a lot of results, you may be aching to increase this number.

    In the case of my blog, I have the number of posts set to 5. I found that the number of summarised search results would look best at 16.

    Unfortunately, this is a bit of a manual fix. First of all, dig out your themes search.php file again. Hopefully you should be able to find the following line of code within it…

    <?php if (have_posts()) : ?>

    When you have, insert the following just before it…

    <?php
    $wp_query->query_vars["posts_per_page"] = 16;
    $wp_query->get_posts();
    ?>

    This will override the number of posts just for the search results.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.