[Plugin: The Events Calendar] Event category template
-
Hi there! I’m new in wordpress and i’m lovin it, i also really appreciate the-events-calendar plugin. A feature i was missing was to use different templates to show events depending on the event’s category. Finally i managed it in a very simple way, but i had to edit a core class of the plugin.
In /wp-content/plugins/the-events-calendar/ i edited the-events-calendar.class.php i changed the lines 430-438
fromglobal $wp_query; $this->constructDaysOfWeek(); // list view if ( $this->in_event_category() && ( events_displaying_upcoming() || events_displaying_past() ) ) { if( '' == locate_template( array( 'events/list.php' ), true ) ) { load_template( dirname( __FILE__ ) . '/views/list.php' ); } exit; }
to
global $wp_query; $tecCatObject = get_category( $wp_query->query_vars['cat']); $this->constructDaysOfWeek(); // list view if ( $this->in_event_category() && ( events_displaying_upcoming() || events_displaying_past() ) ) { if( '' == locate_template( array( 'events/list-'.$tecCatObject->slug.'.php' ), true ) ) { if( '' == locate_template( array( 'events/list.php' ), true ) ) { load_template( dirname( __FILE__ ) . '/views/list.php' ); } } exit; }
this way now i’m able to use a different listing template based on the category of events i’m viewing.
I hope it could be helpfull for someone but I’d be even happier if it could be a feature in a next release..
one love
gio
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘[Plugin: The Events Calendar] Event category template’ is closed to new replies.