Archived topic
Child theme's style.css and elements not working at the same time
3 replies · Started by Neil on November 24, 2019
I have a problem with the CSS within my child theme not working when I have the following in functions.php`.
function generatepress_child_enqueue_scripts() {
if ( is_rtl() ) {
wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
}
}
add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 );
add_action( 'wp_enqueue_scripts', function() {
wp_dequeue_style( 'generate-child' );
}, 50 );
The problem is solved when I remove:
add_action( 'wp_enqueue_scripts', function() {
wp_dequeue_style( 'generate-child' );
}, 50 );
However, this stops the Elements from working.
Is there a solution where I can get both the CSS in the child theme and the elements working at the same time?
Hi there,
That piece of code is preventing the CSS in your child theme to load so you definitely don't want that:
https://generatepress.com/forums/topic/avoid-loading-css-child/#post-1062112
It shouldn't have anything to do with Elements though.
What issues are you having with elements?
Thanks very much. This seems to have fixed the issue.
No problem :)