Wordpress child theme style.css not working

前端 未结 5 1913
[愿得一人]
[愿得一人] 2021-02-01 21:34

I have created a file structure in the same format as my parent theme. My parent theme is called Alpine and within Alpine there is a functions.php and style.css file. There do n

5条回答
  •  故里飘歌
    2021-02-01 21:43

    You need to enqueue the child theme style.css so your function should be:

    function my_theme_enqueue_styles() {
    
        $parent_style = 'parent-style'; 
    
        wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( $parent_style ),
            wp_get_theme()->get('Version')
        );
    }
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    

    Take a look at the documentation.

提交回复
热议问题