-
HHi, I’m trying to style some specific things on my WooCommerce pages (like buttons, error message boxes etc.) But my CSS – which is in my Child theme – is getting overwritten all the time. Would it be a good idea to get my GeneratePress Child Theme CSS to load after the WooCommerce CSS? And if so, please could you help me with the code to enqueue this.
Currently I have the following code in my Child Theme PHP file:<?php add_action('enqueue_block_editor_assets', function() { // Enqueue the child theme's style.css for the block editor wp_enqueue_style( 'child-theme-editor-style', // Unique handle for the stylesheet get_stylesheet_uri(), // Gets the full URL to the child theme's style.css array(), // Dependencies (e.g., ['wp-edit-blocks'] if needed) wp_get_theme()->get('Version') // Version number from the theme ); }); /*Opens site wrapper div */ add_action('generate_before_header', 'tct_open_wrapper'); function tct_open_wrapper(){ echo '<div class="site-wrapper">'; } /*Closes site wrapper div */ add_action('generate_after_footer', 'tct_close_wrapper'); function tct_close_wrapper(){ echo '</div>'; } Thank you! ?> -
Hi there,
There isn’t a way to change the order of the CSS files, unfortunately!
In this case, you need to use more specific selectors so your CSS can override Woocommerce’s CSS.
-
Okay thank you Yin,
I understand. -
You are welcome 🙂
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.