Skip to content

Instantly share code, notes, and snippets.

@askwpgirl
Last active October 18, 2024 18:24
Show Gist options
  • Save askwpgirl/9c942e4afed3c063f9e9bf690614db6e to your computer and use it in GitHub Desktop.
Save askwpgirl/9c942e4afed3c063f9e9bf690614db6e to your computer and use it in GitHub Desktop.
Dequeue errant The Events Calendar Elementor Template CSS
// TEC tries to load its auto generated Elementor "Starter" template CSS on every event.
// This CSS file will throw a 404 since it will never be used on any event under any circumstance.
// To prevent this, use the following function in your child theme's functions file or Code Snippet plugin.
// Change the template ID to the ID of the template under Templates > Saved Templates > The Events Calendar – Starter
// You cannot delete this template as TEC will auto generate it again.
// This CSS is enqueued in TEC free plugin - src > Events > Integrations > Plugins > Elementor > Asset_Manager.php
function dequeue_elementor_event_template_styles_on_single_event() {
// Check if this is a single event page
if ( is_singular('tribe_events') ) {
wp_dequeue_style( 'elementor-event-template-15762' ); // change the ID number here to match the ID of the template (see above)
}
}
add_action( 'wp_enqueue_scripts', 'dequeue_elementor_event_template_styles_on_single_event', 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment