Okay so i did manage to add some custom css selectively on pages that load the medialement player by adding this to my functions.php file:
function custom_player() {
wp_enqueue_style(
'custom-player',
get_stylesheet_directory_uri() . '/wp-mediaelement.css'
);
$custom_css = "
/*here goes the css*/
";
wp_add_inline_style( 'custom-player', $custom_css );
}
add_action( 'wp_enqueue_scripts', 'custom_player' );
Like this by using wp_add_inline_style()
i don’t need to add some !important
css in my theme stylesheet.
Is it a proper way to do it?
[EDIT]
I tried using the dequeue/deregister method above with ‘wp-mediaelement’ as $handle, but it’s totally breaking the layout. I think it could be because when the mediaelement files are loaded there aren’t any .css files among it, just .js scripts. So by using the dequeue/deregister method i only get to load some extra css… and that doesn’t play well.
But now how can that even be possible? Shouldn’t the default css files be enqueued somewhere?