Michael on "Override plugin css with child theme css"

ساخت وبلاگ

I'm running a twentysixteen child theme.

How do I override a plugin css in the child theme?

Surely there must be a way to override it without editing the plugin css directly in the plugin folder and have it overwritten by the next plugin update?

I tried Simple Custom CSS. Didn't help. It loads before the plugin css. I've seen this recommended in various places, and maybe it worked in the past, but in the latest WP it doesn't.

I tried the below code in my functions.php as recommended elsewhere. Same result.

add_action( 'wp_enqueue_scripts', 'generate_remove_scripts' );
function generate_remove_scripts()
{ wp_dequeue_style( 'generate-child' );
}
add_action( 'wp_enqueue_scripts', 'generate_move_scripts', 999 );
function generate_move_scripts()
{ if ( is_child_theme() ) : wp_enqueue_style( 'generate-child', get_stylesheet_uri(), true, filemtime( get_stylesheet_directory() . '/style.css' ), 'all' ); endif;
}

I tried the !important tag and it doesn't help because the plugin css also uses !important for everything.

And yes, I'm sure the plugin css is being loaded last. Its contents are at the top of the css in chrome developer console, and the other sources such as my theme css and Custom Simple CSS are below it.

I also tried adding the css undeeath wp_head() in the header.css as follows. It still is shown in developer console as loading before the plugin css.

<?php wp_head(); ?> <!-- plugin overrides --> <link rel="stylesheet" href="http://mysite.com/wp-content/themes/ab/plugin-overrides.css" type="text/css" />

- - , .
.

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 235 تاريخ : چهارشنبه 23 تير 1395 ساعت: 7:09