The site I'm building has a directory element, which has a lot of different business listings; this is a custom post type. It has a Custom Taxonomy called Trades under which are different types of businesses, e.g plumbers, electricians, decorators, accountants etc. II've written a search form and put it into searchform.php
, which is then called by get_search_form()
, here it is:
<form role="search" class="main-search" action="<?php bloginfo('home') ?>" method="get">
<div class="search-container">
<input type="text" class="main-search-field" placeholder="Search for a service..." name="s" id="s">
</div>
<input type="hidden" name="post_type" value="directory">
<div class="submit-container">
<button type="submit" class="main-submit-btn">Search</button>
</div>
</form>
As you can see, I have narrowed the search down to my Custom Post Type ('directory') but I'm not sure how to narrow it down further. Essentially, when text is entered into the search box, and the user presses enter, I want it to search all my Trade terms, instead of searchsearching post titles/content. Does anyone know how I'd go about doing this?
Thanks for any help :)