WordPress.org

Forums

How to limit posts shown in seach results and on index pag to one category only? (3 posts)

  1. rickd
    Member
    Posted 6 years ago #

    Hi,

    How do I limit the posts shown on my index page and in the search results to posts from one category only?

    I tired using [code]query_posts('category_name=news');[/code] but this caused the search results page to show all posts from that category and ignore the search.

  2. VelvetBlues.com
    Member
    Posted 6 years ago #

    You could try it with something like this:

    query_posts($query_string.'&category_name=news')

  3. cmsme
    Member
    Posted 6 years ago #

    hi, thanks for the solution, could you please explain where to put this?
    how would i use 3 different search results for three different templates for my site?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.