Hi,
Glad you’re enjoying the plugin.
The best way to do this would be to copy and modify the search categories template under/events-manager/templates/templates/search. This tutorial shows you how to do that in an upgrade safe way:
http://wp-events-plugin.com/documentation/using-template-files/
You’d then need to edit the wp_dropdown_categories function in the template to exclude the category IDs you don’t want to display.
Thread Starter
deez
(@devonscalisi)
Hi Caimin,
Thanks for your help! I’m a little bit of an amateur with PHP. Can you help me figure out what code I would add to this file that would allow me to exclude categories in the dropdown menu by IDs?
<?php $args = !empty($args) ? $args:array(); /* @var $args array */ ?>
<!-- START Category Search -->
<div class="em-search-category em-search-field">
<label><?php echo esc_html($args['category_label']); ?></label>
<?php
EM_Object::ms_global_switch(); //in case in global tables mode of MultiSite, grabs main site categories, if not using MS Global, nothing happens
wp_dropdown_categories(array( 'hide_empty' => 0, 'orderby' =>'name', 'name' => 'category', 'hierarchical' => true, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $args['category'], 'show_option_none' => $args['categories_label'], 'class'=>'em-events-search-category'));
EM_Object::ms_global_switch_back(); //if switched above, switch back
?>
</div>
<!-- END Category Search -->
The line you need to edit is the one that starts wp_dropdown_categories. Try using this line instead:
wp_dropdown_categories(array( 'exclude' => '1,2','hide_empty' => 0, 'orderby' =>'name', 'name' => 'category', 'hierarchical' => true, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $args['category'], 'show_option_none' => $args['categories_label'], 'class'=>'em-events-search-category'));
You’ll see there’s an extra exclude parameter at the start. Just change 1 and 2 to the category IDs you want to exclude. You can add as many more as you like, separating each with a comma.
This might help:
http://codex.wordpress.org/Function_Reference/wp_dropdown_categories
Thread Starter
deez
(@devonscalisi)
Caimin,
Thank you! Worked perfectly.
You are a gentleman and a scholar.
Hi,
i want to exclude the event categories from search in my web. i had used search every-thing plugin for search so please help me how to exclude the event-categories from it.