[Resolved] Child theme's style.css and elements not working at the same time

Home Forums Support [Resolved] Child theme's style.css and elements not working at the same time

Home Forums Support Child theme's style.css and elements not working at the same time

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1075288
    Neil

    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?

    #1075330
    Leo
    Staff
    Customer Support

    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?

    #1098098
    Neil

    Thanks very much. This seems to have fixed the issue.

    #1098107
    Leo
    Staff
    Customer Support

    No problem 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.