0

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

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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