Version: 2.1.0! Changelog
The Events Calendar (TEC) is a very powerful WordPress plugin for managing events. However, the way its templates and CSS are implemented—especially the v2 templates—leave much to be desired.
This repository contains useful reset files and a checklist of changes I make on nearly every project that uses The Events Calendar. I wish it weren't so long!
I'm Mark Root-Wiley of MRW Web Design. I build WordPress websites for nonprofits. Checkout my free resource site Nonprofit WP and my free plugins.
If this saves you an hour and a bunch of frustration, consider buying me a coffee or a beer to say thanks! 🍻☕
There are two complimentary stylesheets so that TEC inherits and uses more theme styles. This is especially powerful if you are using /theme.json
to set colors, font sizes, and a spacing scale.
- Use
css/tec-remap-custom-properties.scss
to override a number of TEC defaults with WP/theme.json
defaults- Follow instructions in file header to review styles, customize additional properties, and delete what you won't be using
- Use
css/tec-inherit-values.scss
reset stylesheet below to get rid of numerous hard-coded values and inherit more theme styles- Optionally set CSS properties to match theme font sizes and colors
- Add custom styles to blocks.
- (Optional) Reference list of useful TEC styling selectors as starting point (slightly outdated as of August 28, 2023).
TEC provides a powerful system to override various plugin templates like the page-level templates all the way down to a specific block. Most sites will need to customize multiple templates for best results.
- Copy and customize
/tribe/events/v2/default-template.php
into/{theme}/tribe/events/v2/
- Clean up one or both single event templates:
- Classic Editor Events:
/{theme}/tribe-events/single-event.php
- Block Editor Events:
/{theme}/tribe/events/single-event-blocks.php
- Classic Editor Events:
- Customize additional templates as needed. Recommended accessibility fixes to templates:
-
/{theme}/tribe/events/v2/list/event.php
- Datetime should follow the event's title heading for logical structure -
/{theme}/tribe/events/v2/latest-past/event.php
- Datetime should follow the event's title heading for logical structure -
/{theme}/tribe/events/blocks/event-datetime.php
- Don't use a Heading 2 for logical heading structure on single events -
/{theme}/tribe/events/v2/list/event/feature-image.php
- Applyaria-hidden="true"
to featured image link since it's redundant with the event title link in list view
-
- Fix a few things about event pages and set a custom default block template with mu-plugin in
mu-plugins/tec-customizations.php
in this repository- Customize the default block for a new Event with the
tribe_events_editor_default_template
filter. See/example-block-templates/
for examples of block templates of various complexity
- Customize the default block for a new Event with the
- Install Post Type Archive Descriptions for an editable area at the top of the main events page
- Explore additional TEC extensions for customizations (e.g., hide past events, "tweaks" plugin, etc.)
In TEC v2 templates, you can use the tribe_template_pre_html
filter to hide specific template parts. For example, to hide the "Read More" links in list views:
/* Hide "Read More" links */
add_filter( 'tribe_template_pre_html:events/v2/components/read-more', '__return_false' );
You can also helpfully add content before or after any template part using tribe_template_before_include
and tribe_template_after_include
. For example:
/* Add "Hello World" after the "Views" selector in the event bar */
add_action( 'tribe_template_before_include:events/v2/components/events-bar/views', function( $file, $name, $template ) {
echo 'Hello World';
}, 10, 3 );
- Better defaults and cleaner styles for Datetime, Price, Venue, and Organizer blocks
- Style notices with existing TEC custom properties that aren't used for some reason
- Remove SASS nesting so this can be used as plain CSS if desired
- Remove
post_tag
taxonomy from events and don't know tribe_events posts in Tag archives - Add new custom properties in attempt to prevent "flash of TEC blue" links and buttons
- Change the organizer link text to the organizer's name
- Ensure Subscribe button menu appears above other stuff
- New function in mu-plugin to replace wrapping
section
with adiv
for better semantics - Move custom properties in
_tec-inherit-values.css
to thebody
instead of:root
so they have access totheme.json
values set onbody
- Make sure the datetime block children inherit
font-size
from the body (or block parent) - Replace hard-coded namespace with
__NAMESPACE__
to avoid problem when changing namespace - Hide top border and padding above venue blog and event paging
- Remove checklist item for old
default-template.php
file that is no longer included in the plugin
- This is now a git repository rather than a gist!
- Rename css files for clarity
- Provide fallbacks for custom properties in
tec-inherit-values.css
- Split examples into separate files in new examples folder
- Add
CONTRIBUTING.md
- Added new
_tec-reset-variables.scss
file for better style reset coverage and more stuff working "out of the box". - Removed some rules from
_tec-reset-styles.scss
that are no longer necessary due to new custom property definitions. - Add some more useful snippets to the mu-plugin (hide recent past events, show past events in reverse chronological order)
- Add absolute position to export events drop-down so it doesn't reflow the page
- Add \MRW\TEC\is_tribe_view() function to detect when a TEC page is active (great for enqueueing custom styles!)
- Fix: Put mobile-specific styles for event datetime into media query
- Remove some dead highlighting styles
- Remove snippet to add post type archive description and just recommend Post Type Archive Descriptions plugin more obviously
- Remove link to "Remove Export Links" TEC add-on which is no longer available. Add link to extensions page instead
- Remove some recommended accessibility template fixes that have been integrated into the plugin!
- Remove font-family now that there's a customizer setting for it
- Attempt to improve subscribe button style overrides dealing with weird focus and hover behaviors. Absolute position dropdown to avoid layout jank
- Improvements to subscribe button overrides to make them more likely to win over unwanted theme styles
- Fix featured event styles in month view
- Add styles to override subscribe button styles
- New suggestion to hide featured image from assistive technology in list views
- Add equivalent template changes to
/latest-past/
templates to match/list/
changes where applicable
- Add new selectors for heading styles and links on the new single event templates to match other override styles (fonts, underlining behavior, etc.)
- Increase specificity of
.tribe-common-c-btn
selectors in order to override messed up settings in plugin and ensure the search bar button is the correct color - Remove filter that hid the back link on the single template. Does not work in v2 single events.
- Add new selectors to inherit font styles from the theme
- Add editor selectors to try to style blocks closer to front-end. Results will vary.
- Bug fix for TEC 5.7.0 template_include filter
- Add
/v2/
to path oftribe_template_before_include
filter to fix bug in TEC 5.5. - Remove errant SASS variable in style resets
- Fix missing accent customization for Featured Styles in list view. Adds new
--tec-accent-color
variable that defaults to--tec-link-color