WordPress.org

Support

Support » Plugins and Hacks » How to limit posts shown in seach results and on index pag to one category only?

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

  • rickd
    Member

    @rickd

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • VelvetBlues.com
    Participant

    @velvetbluescom

    You could try it with something like this:

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

    Feathers
    Member

    @cmsme

    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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to limit posts shown in seach results and on index pag to one category only?’ is closed to new replies.