-
-
Save MikeNGarrett/3268062 to your computer and use it in GitHub Desktop.
The Events Calendar: List Event Categories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // If you'd rather have category drop downs ?> | |
<form action="#" method="get" id="event-change"> | |
<?php | |
$current = get_query_var('tribe_events_cat'); | |
$terms = get_terms($tribe_ecp->get_event_taxonomy()); | |
$count = count($terms); | |
if ( $count > 0 ){ | |
echo '<select class="events-cat-menu"><option value="-1">All Events</option>'; | |
// print_r($terms); | |
$selected = ''; | |
foreach ( $terms as $term ) { | |
if($current == $term->slug) { $selected = 'selected="selected"'; } | |
echo '<option value="'. get_term_link($term->slug, 'tribe_events_cat') .'" '.$selected.'>' . $term->name .'</option>'; | |
$selected = ''; | |
} | |
echo '</select>'; | |
} | |
?> | |
<noscript><input type="submit" value="&rarr;"></noscript> | |
</form> | |
<script type="text/javascript"> | |
jQuery(document).ready(function($){ | |
$('.events-cat-menu').change(function() { | |
location = $(this).val(); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment