How do i change search query?
I have installed Instant Q&A wordpress theme for one of my website. There is a Find a Question search box, i want to change the query which runs 开发者_Python百科in the background that is which retrieves the records. I am attaching the screen shot of the same. I have traced that there is a searchform.php which is loading the search form but i am unable to trace the code which fetches the records.
Please help me on this.
Thanks,
Pankaj
searchform.php contains just an html template for the search form. Also in your template (probably) you have search.php that is another template for the search results. But the queries are not part of the templates and they are a bit hard to modify inside the wordpress code.
But, just adding input fields to searchform.php can be a solution for you. As an example, if you want to search for posts with a given keyword (search field) inside a category, you can add to your searchform.php:
<input type="hidden" name="category_name" value="my-category" />
I guess (but I am not sure) you could use any query var as you do with query_posts().
精彩评论