Community Forums › Forums › Archived Forums › General Discussion › Can I override any plugin's css using my child theme
- This topic has 5 replies, 2 voices, and was last updated 8 years ago by
westerdaled.
-
AuthorPosts
-
March 19, 2015 at 2:24 pm #144962
westerdaled
MemberHi
I doing a bit of house keeping on my Metro Pro blog and noticed there is still an issue with the Yoast Plugin which requires some classes in metabox-tabs.css following classes to have the display property overridden ( or removed entirely in FireBug)
ul.wpseo-metabox-tabs { display: none; margin-top: 12px; margin-bottom: 3px; } .wpseotab { display: none; }
Anybody suggest how I could override these in the child theme or some other technique applicable to Genesis?
Daniel
March 19, 2015 at 7:17 pm #144978Brad Dalton
ParticipantTry !important Example http://www.w3.org/TR/CSS2/cascade.html#value-def-inherit
Or
You can dequeue your plugins style sheet from your child theme and load it in your child theme.
March 20, 2015 at 8:33 am #145021westerdaled
MemberBrad
Thanks for your reply .
1) I have tried
display: block !important;
to both of the above classes and this had no effect. Incidentally, to test moved from FireFox->Firebug to Chrome-Web Developer tools plugin and this is taking a bit of getting used to to see what .css is loads. I use for Chrome in all my VMs
I have looked at the functiions.php and I need to add an action to dequeue metabox-tabs.min.css and paste these classes into styles.css .. This strikes me as a maintenance headache after updates to my theme or changing the them altogether . Unless there is normal practice for WordPress devs or there isn't a a ultra simpler way of sorting this, such as adding override.css as the last Css to be added.
One thought depending on your answer is if Genesis SEO is good as people indicate it is, then why am I bothering with Yoast and wresting with this issue?
March 20, 2015 at 8:40 am #145026Brad Dalton
ParticipantThe dequeue function doesn't seem to work very well based on my experiences using it. Just make sure you use the same handle used for enqueueing it in the plugin.
There's no updates to child themes.
Different people have different opinions on SEO.
I think Yoast has some good features but i don't see any proof any SEO plugin makes any difference.
I did notice in some cases the SEO settings page for Genesis SEO disappear after deactivating Yoast where they're supposed to come back.
March 21, 2015 at 2:24 pm #145111westerdaled
MemberBrad
Ok , with your guidance and a bit of Googling I quickly built a plugin in NotePad++ to do as you suggested
function wsl_css_fixes_added_to_head() { //wp_enqueue_script('jquery'); /* the code class-metabox.php: wp_enqueue_style( 'metabox-tabs', plugins_url( 'css/metabox-tabs' . WPSEO_CSSJS_SUFFIX . '.css', WPSEO_FILE ), array(), WPSEO_VERSION ); */ /* remove the above class library that is supplied by Yoast */ wp_dequeue_style( 'metabox-tabs' ); $fixstyle = WSLCSSFIXES_PLUGIN_URL . '/css/metabox-tabs-fixed.css'; $handle = 'metabox-tabs-fixed' ; wp_register_style( $handle, $fixstyle,'','', 'screen' ); wp_enqueue_style( $handle); } /* attach my custom hook function to this event */ add_action( 'wp_enqueue_scripts', 'wsl_css_fixes_added_to_head' ); /* Stop Adding Functions Below this Line */ ?>
I Ftped my plugin over to my blog site and activate my plugin. I can see my style sheet is there on my home page ( in Firebug lite) - I can even inspect my css file to see I have removed the display property in two of the classes. The thing is the Yoast options panel on the page edit screen is where I should be triggering my dequeue metabox tabs and enqueuing my fix css so I need to hook into that event....
March 23, 2015 at 11:44 am #145346westerdaled
MemberHi any update on this please. Is it easy to inject styles or scripts in this location?
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.