0

I'm working on a website currently where I'm being asked to style the event pages. The events are being handled by EventON and I'm having a ton of trouble trying to override any styles they have in place. I've added styles to Settings > Styles in the Wordpress Admin and to the theme's stylesheet (even added !important, as a last ditch effort), but none of it overrides EventON's default styling. So I've been working to try and dequeue their styles altogether and style them from scratch. If anyone can help me on this, I'd greatly appreciate it! Here's my code that isn't working (added to functions.php):

I started here:

function plugin_dequeue_styles() {
  wp_dequeue_style('eventon_dynamic_styles');
}
add_action('wp_print_styles', 'plugin_dequeue_styles');

Then tried this:

function plugin_dequeue_styles() {
  wp_dequeue_style('eventon_dynamic_styles', plugin_dir_url('eventon_dynamic_styles.css') );
}
add_action('wp_print_styles', 'plugin_dequeue_styles');

And then this:

function plugin_dequeue_styles() {
  wp_dequeue_style('eventon_dynamic_styles', plugins_url('/assets/css/', 'eventon_dynamic_styles.css') );
}
add_action('wp_print_styles', 'plugin_dequeue_styles');

I am thinking the last 2 are more along the right path, but I'm not understanding what I'm reading in the Wordpress Codex or something. If anyone can help me out or steer me down the correct path, that would be amazing.

Thanks!

0

TL;DR

This is the answer:

add_action( 'wp_enqueue_scripts', function() {

wp_dequeue_style( 'evo_font_icons');
wp_deregister_style( 'evo_font_icons');

wp_dequeue_style( 'evcal_cal_default');
wp_deregister_style( 'evcal_cal_default');

wp_dequeue_style( 'evo_single_event');
wp_deregister_style( 'evo_single_event');

wp_dequeue_style( 'evcal_addon_styles');
wp_deregister_style( 'evcal_addon_styles');

wp_dequeue_style( 'evo_addon_styles');
wp_deregister_style( 'evo_addon_styles');

wp_dequeue_style( 'evo_fc_styles');
wp_deregister_style( 'evo_fc_styles');

wp_dequeue_style( 'eventon_dynamic_styles');
wp_deregister_style( 'eventon_dynamic_styles');

wp_dequeue_style( 'evo_TX_styles');
wp_deregister_style( 'evo_TX_styles');

}, 20);

Explanation

First of all: eventON is a pain to override styles with. The default styles are too nested, which makes overriding them inefficient and problematic.

That being said, !important should always work, if not, you are not doing something right within your own stylesheets. You can check if your styles are are even loaded through Google Dev tools, even if they are overriden by eventON.

To answer your question:

You need to use the correct handle to dequeue the styles. In order to get the correct handles, you can use a simple var_dump() of all enqueued styles to see which eventon styles are being used and what their handles are:

<?php
global $wp_styles;
var_dump( $wp_styles );
?>

Based on that, we can modify our dequeue-script as seen above.

  • Thanks! This worked! And yes, my styles were always there when using Chrome's dev tools, but always overridden, even with important tags on them. It was getting frustrating, so I really appreciate your help! – jtomeck Jun 5 '18 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.