Support

Home Forums Event Espresso Premium Adding category filters to custom table

Adding category filters to custom table

Posted: June 9, 2014 at 5:01 am

Viewing 8 reply threads


Ben

June 9, 2014 at 5:01 am

Hi Guys,

Can someone point me in the right direction please as to how I go about adding additional category filters to the custom ‘Events Table’ – https://eventespresso.com/wiki/custom-template-add-on/

http://screencast.com/t/wIQDhp7tIvMG

Is it by using the meta boxes? – http://screencast.com/t/s1MTHPG8CtaO

Thanks.


Sidney Harrell

June 9, 2014 at 12:52 pm

I’m guessing that you are going to use it for multiple categories per event. So that to show the event, it has to match all the categories selected? The first step would be to fix the table so that it correctly adds a class to the row for each category the event has. You’ll want to edit plugins/espresso-custom-templates/templates/events-table/index.php to replace lines 87-93 with the following:


Ben

June 12, 2014 at 5:03 am

Thanks Sidney,

I’ve been working on just having the 3 different category filters to test it out, as seen here – http://screencast.com/t/npUYgypun

Here is the code – http://screencast.com/t/WpIoQzKmHsTz
I can’t figure out how to get the venue and date filters to appear in the category?

Thanks
Ben


Dean

June 12, 2014 at 5:17 am

Something like this?

<p class="category-filter"><label><?php echo __('Filter by category ', 'event_espresso'); ?></label>
<select class="" id="ee_filter_cat">
	<option class="ee_filter_show_all"><?php echo __('Show All', 'event_espresso'); ?></option>
	<?php
		foreach($events as $event_date) {
			echo '<option value="' . $event_date->start_date . '" class="date_' . $event_date->start_date . '">'. date('m/d/Y', strtotime($event_date->start_date) ) . '</option>';
		}
    ?>
</select></p>
<p class="category-filter"><label><?php echo __('Filter by category ', 'event_espresso'); ?></label>
<select class="" id="ee_filter_cat">
	<option class="ee_filter_show_all"><?php echo __('Show All', 'event_espresso'); ?></option>
	<?php
		foreach($events as $venue_id) {
			echo '<option value="' . $venue_id->venue_id . '" class="date_' . $venue_id->venue_id . '">'. $venue_id->venue_name . '</option>';
		}
    ?>
</select></p>

You will need to modify the jQuery to make it so that it filters correctly. That will be the hardest part I think.


Ben

June 12, 2014 at 5:53 am

Thanks Dean,

Do you think a class and category also has to be added here too? – <select class="" id="ee_filter_cat">

Then replicate those differences in the jQuery also?

Thanks.


Ben

June 12, 2014 at 5:53 am

Row 2 in your code.


Dean

June 13, 2014 at 2:40 am

Yeah,

Just add something like

class="cat_<?php echo $cat_class; ?>"


Ben

June 13, 2014 at 4:24 am

Thanks Dean.


Dean

June 13, 2014 at 5:01 am

No problem!

Viewing 8 reply threads

The support post ‘Adding category filters to custom table’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso