• bjarnijo90

    (@bjarnijo90)


    So I changed from using @import to using php to get my stylesheet from my parent theme and now only SOME of the CSS is loading and not some?!

    My php in child theme:

    <?php
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    
    }
    ?>

    When I load the page, most of the stuff I’ve changed in the child .css theme loads like it should, but it’s adding some borders and it doesn’t have the sizing options I did and stuff that is still written in the child .css. The only file I’ve edited is style.css.

Viewing 1 replies (of 1 total)
  • Thread Starter bjarnijo90

    (@bjarnijo90)

    Typical. I fixed it a second after posting this (I had been dealing with this all day) by using:

    <?php
    function 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 )
        );
    }
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    ?>

    Instead.

Viewing 1 replies (of 1 total)
  • The topic ‘Bizarre problem with child theme’ is closed to new replies.