I have a few dropdown select option in my wordpress sidebar:
Whenever a user selects an option from any of the dropdown, they are directed to the search result page:
http://mywebsite/wp/?post_type=post&taxonomy=category&terms=29&search_type=or&order=title
The 29
is the Tag that is searches for which is what the user selected.
I am doing that functionality with JQuery:
$('select').on('change', function () {
var url = $(this).val(); // get selected value
if (url) { // require a URL
window.location = "http://mywebsite/wp/?post_type=post&taxonomy=category&terms=" + url + "&search_type=or&order=title"; // redirect
}
return false;
});
I was trying to, instead of the above JQuery to have this:
$("#search").click(function(){
var k = $("#mtsw-form-children-term-ids-10 option:selected").val();
var m = $("#mtsw-form-children-term-ids-13 option:selected").val();
var o = $("#mtsw-form-children-term-ids-11 option:selected").val();
alert("Location: " + k + "\nSpecialty: " + m + "\nPhysician: " + o);
//window.location = ; //SEARCH BASED ON LOCATION, and/or SPECIALTY, and/or PHYSICIAN tags
});
I am using the Multi-Term-Selection widget for the dropdown.
How would I know if I am able to accomplish that search? I am new to WordPress so I am trying to understand the starting point.