Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Best way to add a search function? WordPress

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.

Answers (7)

2012-05-18

Fahad Murtaza answers:

Try this

http://mywordpress.ru/plugins/search-in-category/


Fahad Murtaza comments:

google translate should help you understand easily.

2012-05-18

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?

2012-05-18

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>

2012-05-18

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.

2012-05-18

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>

2012-05-18

Nilesh shiragave answers:

Try following plugin

[[LINK href="http://codecanyon.net/item/5sec-category-search/231888?ref=neel"]]5sec category search[[/LINK]]

2012-05-18

Arnav Joy answers:

check this link

http://wordpress.stackexchange.com/questions/14241/search-form-with-category-and-sub-category