I have a page which has loads of resources in different categories. I want to add a search function to that page that only searches within the resources category and sub categories.
Fahad Murtaza answers:
Try this
http://mywordpress.ru/plugins/search-in-category/
Fahad Murtaza comments:
google translate should help you understand easily.
Francisco Javier Carazo Gil answers:
Hi Steve,
Which kind of data are these categories, subcategories and resouces.
Do you use custom post type and custom taxonomies?
Agus Setiawan answers:
hi steve, hope this code will help you
<form method="get" id="search form" action="/">
<div>
<input type="text" value="" name="s" id="s" />
<input type="hidden" value="22" name="cat" id="scat" />
</div>
</form>
Michael Caputo answers:
You need to add a hidden field to your search form. It would look something like this:
<input type=”hidden” name=”cat” value=”31,7″/>
You see in the 'value' field there is 28, and 7 - change those numbers to the category ID of the categories you would like to include in your search.
Jatin Soni answers:
Place below code into the page template to search by category dropdown list.
<form class="searchcat" role="search" method="get" id="searchform" action="<?php bloginfo('url'); ?>">
<div class="rowElem">
<input type="text" value="" name="s" id="s" tabindex="1" placeholder="search here..." /><?php wp_dropdown_categories( 'show_option_all=All Type' ); ?>
<input type="submit" id="searchsubmit" value="Search" tabindex="2" />
</div>
</form>
Nilesh shiragave answers:
Try following plugin
[[LINK href="http://codecanyon.net/item/5sec-category-search/231888?ref=neel"]]5sec category search[[/LINK]]
Arnav Joy answers:
check this link
http://wordpress.stackexchange.com/questions/14241/search-form-with-category-and-sub-category