• Resolved Brett Donald

    (@brettdonald)


    When I switch to a child theme, the dark mode switch has no effect. In fact, none of the dynamic styles seem to take effect.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Theme Author Alexander Agnarson

    (@alxmedia)

    Hi Brett,

    What code do you have in your functions.php of the child theme?

    Thread Starter Brett Donald

    (@brettdonald)

    <?php
    add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
    function enqueue_child_theme_styles() {
      wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }
    ?>
    Theme Author Alexander Agnarson

    (@alxmedia)

    What if you add something like this:

    
    function gridzone_styles() {
    		wp_enqueue_style( 'gridzone-style', get_stylesheet_uri() );
    		if ( get_theme_mod('responsive','on') =='on' ) { wp_enqueue_style( 'gridzone-responsive', get_template_directory_uri().'/responsive.css' ); }
    		if ( get_theme_mod('dark','off') == 'on' ) { wp_enqueue_style( 'gridzone-dark', get_template_directory_uri().'/dark.css' ); }
    		wp_enqueue_style( 'gridzone-font-awesome', get_template_directory_uri().'/fonts/all.min.css' );
    		wp_enqueue_style( 'gridzone-child', get_stylesheet_directory_uri().'/style.css' );
    	}
    

    Or this:

    
    function gridzone_styles() {
    		wp_enqueue_style( 'gridzone-style', get_template_directory_uri().'/style.css' );
    		if ( get_theme_mod('responsive','on') =='on' ) { wp_enqueue_style( 'gridzone-responsive', get_template_directory_uri().'/responsive.css' ); }
    		if ( get_theme_mod('dark','off') == 'on' ) { wp_enqueue_style( 'gridzone-dark', get_template_directory_uri().'/dark.css' ); }
    		wp_enqueue_style( 'gridzone-font-awesome', get_template_directory_uri().'/fonts/all.min.css' );
    		wp_enqueue_style( 'gridzone-child', get_stylesheet_directory_uri().'/style.css' );
    	}
    
    Thread Starter Brett Donald

    (@brettdonald)

    Thanks, Alexander. The second of these two options worked for me.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Child theme dark mode’ is closed to new replies.