Hello Aimee,
That’s certainly odd! Does your responsive design rely on any JS that would possibly be conflicting here?
It’s strange that a page that does not have the calendar on it would be affected by the plugin being activated. Do you see any instances where the plugin’s JS/CSS are being added to the the site inadvertently? If so, we can try to dequeue those from there.
Cheers!
Geoff
Hi Geoff,
Just had a look and the JS files don’t seem to be loading on other pages but the css files do.
These are the files that are being loaded on all pages:
/plugins/the-events-calendar/resources/tribe-events-full.min.css
/plugins/the-events-calendar/resources/tribe-events-theme.min.css
/plugins/the-events-calendar/resources/tribe-events-full-mobile.min.css
/plugins/the-events-calendar/resources/tribe-events-theme-mobile.min.css
Do you think that’s the problem? How do you dequeue those?
Regards,
Aimee
Hey Aimee,
Dequeueing those files can be done with some code like the following:
add_action( 'wp_enqueue_scripts', 'aimee_events_calendar_dequeue_css', 30 );
function aimee_events_calendar_dequeue_css() {
wp_dequeue_style( 'tribe-events-full-calendar-style' );
wp_dequeue_style( 'tribe-events-calendar-style' );
wp_dequeue_style( 'tribe-events-calendar-full-mobile-style' );
wp_dequeue_style( 'tribe-events-calendar-mobile-style' );
}
Now, if there are only specific pages that you want that code to be removed from, you could find the page’s ID and only specify that code to run on that page. For example, if you found the page IDs you wanted to prevent the Calendar CSS from being loaded on to be 123, 43, and 869, you could modify the above function to look like this instead:
add_action( 'wp_enqueue_scripts', 'aimee_events_calendar_dequeue_css', 30 );
function aimee_events_calendar_dequeue_css() {
if ( is_page( 123 ) || is_page( 43 ) || is_page( 869 ) {
wp_dequeue_style( 'tribe-events-full-calendar-style' );
wp_dequeue_style( 'tribe-events-calendar-style' );
wp_dequeue_style( 'tribe-events-calendar-full-mobile-style' );
wp_dequeue_style( 'tribe-events-calendar-mobile-style' );
}
}
You can learn more about that is_page() function here → https://codex.wordpress.org/Function_Reference/is_page
And you can learn about other conditionals instead of is_page(), which might help cast a wider net than just manually checking each page ID, here → https://codex.wordpress.org/Conditional_Tags
I hope that helps!
Cheers,
George