Category: Plugins

The Events Calendar Pro: Filter By Category

Yes, we’ve all been anticipating the infamous ‘Filter Panel Add-on” for TEC Pro, but to no avail. I had promised a client this ability months ago when the add-on was supposed to be coming out, but since it has not and I still promised this delivery, I’ve come up with my own solution (with a little googling and some trial and error). It is likely not the cleanest or best solution, but it does work (Using TEC Pro 3.X).

In modules/bar.php I’ve added this code. It allows all categories in the events to be listed and selected, then send to the url on select, keeping the existing functionality of TEC in tact. Please note pretty permalinks must be enabled for this code.

//list terms in a given taxonomy
$taxonomy = ‘tribe_events_cat’;
$tax_terms = get_terms($taxonomy);
<div id=”tribe-bar-cats”>
<select id=”tribe-category” onchange=”if (this.value) window.location.href=this.value” >
<option selected value=””>All</option>
<?php foreach ($tax_terms as $tax_term) { ?>
<option value=”<?php echo esc_attr(get_term_link($tax_term, $taxonomy)) ?>”>
<?php echo $tax_term->name ?>
<?php } ?>

To replace the selected option on page load, put this code in your footer:

<script type=”text/javascript”>
jQuery( document ).ready(function() {
var parts = window.location.href;
if (parts.length > 0) {

That should do it! Now we just add a bit of styling and it is good to go!