You’d need to use something like this in your custom form:
http://www.w3schools.com/tags/att_select_multiple.asp
As I mentioned earlier , that is what
$('.em-events-search-category').attr('multiple','');
does
This is the code I need to modify as suggested by philipjohn
$selected = !empty($_REQUEST['category']) ? $_REQUEST['category'] : 0;
EM_Object::ms_global_switch(); //in case in global tables mode of MultiSite, grabs main site categories, if not using MS Global, nothing happens
Here is the category code that outputs a selectbox==>wp_dropdown_categories(array( 'hide_empty' => 0, 'orderby' =>'name', 'name' => 'category', 'hierarchical' => true, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $selected, 'show_option_none' => get_option('dbem_search_form_categories_label'), 'class'=>'em-events-search-category'));
EM_Object::ms_global_switch_back(); //if switched above, switch back
As Phil mentioned earlier, you can’t use the jQuery snippet to modify the behavior of the select – you have to actually make it a mulitselect in the template.
That is what I am asking here now .Code to output categories which allows multiple selection.
The current code wp_dropdown_categories won’t allow multiple selection.
You can’t use wp_dropdown_categories to do this because it’s not able to display in such a way as to allow multiple categories to be selected.
You need to create your own dropdown menu for the multselect.
You can’t use wp_dropdown_categories to do this because it’s not able to display in such a way as to allow multiple categories to be selected.
You need to create your own dropdown menu for the multselect.
That is what I am asking, how do I do that ?
Can’t give a step-by-step, but here’s the gist of it. You’d want to override the templates/templates/search/categories.php file as per these instructions:
http://wp-events-plugin.com/documentation/using-template-files/
http://www.w3schools.com/tags/att_select_multiple.asp
I’m pretty sure that’s all you need, but it’s possible that EM doesn’t accept multiple category searches (never tested it via search form). If that’s the case, then some more coding would need to be done by you, along the lines of:
http://wp-events-plugin.com/tutorials/adding-custom-event-search-form-fields/
but instead convert it to a comma-delimited list of category ids
Thanks Marcus .
Fixed it.
Used
$(function() {
$('.em-events-search-category').attr('size','15');
$('.em-events-search-category').attr('multiple','');
});
Used custom template.
and used comma-delimited list of category ids .
I’ll send you all a box of cookie 😀
Thanks