• Resolved busterland

    (@busterland)


    Hello,

    I tried to add a new stylesheet for my theme but the stlye sheet isn’t loaded. For the moment my website isn’t online so I can’t give you the url.

    My theme is OceanWp. I created a folder “oceanwp-child” in the folder “themes”. The parent folder of this theme is “oceanwp”.

    Here is my file functions.php :

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

    And the file style.css :

    /*
    Theme Name:     Thème enfant OceanWp
    Template:       oceanwp
    Version:        0.1.0
    */
    
    p {
        font-size: 50px;
    	color: red;
    }
    

    Can you tell me if something is missing ? Or what I can check to debug?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • There is a lot of documentation of how to make a child theme and plugins that do it for you.

    But you still have to read the parent theme to see how they are loading the styles, because some load the child styles for the child, some load the parent style with a function that will actually load the child style when there is a child, and some just load the parent style regardless of child theme. And you need to use the same handle so that it’s not loaded twice. (The handle is the name in quotes. In your example code, it is ‘parent-style’, but you need to change that to match what the parent theme uses.) Or better yet, ask in the theme’s support forum.

    I created a folder “oceanwp-child” in the folder “themes”. The parent folder of this theme is “oceanwp”.

    The child theme folder should be at the same level as the parent theme (side by side, not one under the other).

    Thread Starter busterland

    (@busterland)

    Hi
    I downloaded the zip here and it works now :
    https://github.com/oceanwp/oceanwp-child-theme

    Thx

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

The topic ‘Style.css doesn’t load’ is closed to new replies.