The Events Calendar Category Dropdown Menu

Okay so you’re running the Events Calendar (WordPress Plugin) and you’re putting your events into categories. Now you want to show a dropdown menu somewhere on the site which will simply list out those categories and, when selected, take a user to a page that only shows the events which are in that category.

Here you go, just drop this bit of code into your theme wherever you’d like the dropdown to appear:

$terms = get_terms("tribe_events_cat");
$count = count($terms);
if ( $count > 0 ){
echo "<script type='text/javascript'>function taclinkch(x){var y=document.getElementById(x).value;document.location.href=y}</script>";
echo "<form id='tribe-event-category-dropdown' action=''> <select name='eventcats' id='eventcats' onchange='taclinkch('>";
echo "<option value=''>Categories:</option>";
echo "<option value=''.get_bloginfo( 'template_url' ).'/events/'>ALL</option>";
foreach ( $terms as $term ) {
echo "<option value='" . get_site_url() . "/events/category/". $term->slug." '>" . $term->name . "</option>";
echo "</select></form>";

That should set you up beautifully. Note that you’ll need to change the word events in two places if you’ve changed the slug for your particular setup.

Up Next: How to Setup Wootickets for the Events Calendar