In my tutorial requests Trello board a user asked,
The Event Calendar by Modern Tribe - they don't have a way to add the holidays. So I created a category called Holidays. When displayed in List View or Monthly Calendar, I do not want them "clickable" and I do not want the "Read More" or "Find out More" links to display in List View on Mobile. I only want the holidays to display to tell people they are holidays not an actual event. I use this to force list view on mobile - https://theeventscalendar.com/support/forums/topic/forcing-list-view-on-mobile-only/#dl_post-964243.
This tutorial covers the steps to customize The Events Calendar by Modern Tribe Inc. such that events belonging to "Holidays" event category are displayed without hyperlinks in Month and List views.
Step 1
To fix the display of month, list etc. event templates on /events page when Content Archives are set to either Excerpts or Content Limit in Genesis theme settings, add the following in your child theme's functions.php (if not already present):
/**
* The Events Calendar - Bypass Genesis genesis_do_post_content in Event Views
*
* This snippet overrides the Genesis Content Archive settings for Event Views
*
* Event Template set to: Admin > Events > Settings > Display Tab > Events template > Default Page Template
*
* The Events Calendar @4.0.4
* Genesis @2.2.6
*/
add_action( 'get_header', 'tribe_genesis_bypass_genesis_do_post_content' );
function tribe_genesis_bypass_genesis_do_post_content() {
if ( class_exists( 'Tribe__Events__Main' ) && class_exists( 'Tribe__Events__Pro__Main' ) ) {
if ( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week() || ( tribe_is_recurring_event() && ! is_singular( 'tribe_events' ) ) ) {
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
add_action( 'genesis_entry_content', 'the_content', 15 );
}
} elseif ( class_exists( 'Tribe__Events__Main' ) && ! class_exists( 'Tribe__Events__Pro__Main' ) ) {
if ( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() ) {
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
add_action( 'genesis_entry_content', 'the_content', 15 );
}
}
}
Step 2
Copy
wp-content/plugins/the-events-calendar/src/views/month/single-event.php
to
your-child-theme/tribe-events/month/single-event.php
and edit it.
Replace
<h3 class="tribe-events-month-event-title"><a href="<?php echo esc_url( $link ) ?>" class="url"><?php echo $title ?></a></h3>
with
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
Thanks for this. While it isn’t a function I’m specifically looking for right now, I’m grateful to see tutorials on customizing The Events Calendar. I spend a lot of time struggling to customize that plugin.
Hi, Sridhar:
Can I use a filter to display only “views as list”? I wan’t to show only a list of events ordered by date.
Thanks
alpaezes Why add a filter to display only as a list? Why not just set the default view as list and hide the other view options?
Thanks, that’s a good option, can I do it in settings?
You can set the default display in settings, but hiding the other displays options you would need to do via css or adding a function.
The setting for the default display is in The Events Calendar’s menu settings. From your sidebar look for Events > Settings > Display (tab). Then look under Basic Template Settings. The 4th area of Default View you want to set to List.