Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am looking for help with a conditional search based on four categories/taxonomies; countries/regions/type/no of bedrooms. What I am after is a dropdown search function that when I select a specific country, only regions in that country would appear in the region dropdown and in the type drop down, only types available in that particular region would be listed. I am obviously prepared to pay a fee for customisation. JOHN

share|improve this question
add comment

1 Answer

solution 1:

  1. this can be done by adding the drop down menu to the search form.eg cat_slct

  2. create a search template if its not exist in your theme.

  3. add an if statement at the top of the page and directly after get_header();

-

if(isset($_POST['cat_slct'])){

    //make the query using the name of the categoty you'v just received via $_POST[].
    //or search within the database if necessary using the $wpdb object,it helps a lot.
}

}else{

    //the search page as its without modifying.
    //just you have to add the closing else tag before the get_footer(); 

}//right before the get_footer()

solution 2:

  1. same as solution 1 but this time you'll create a page template and call it custom_search.

  2. now go ahead and create a page that uses the custom_page template..eg name it search_cats.

  3. tha different here is that you'll set the action of your targeted search forms to this page.

  4. same as before: get the posted data and insert it into the query then do the regular loop.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.