• pict3000

    (@pict3000)


    All my css works fine when implementing via the “custom css” input field, which inserts the styles in the header of the pages. However, when I try to put the same css into my own child-theme style.css and enqueue it the same way I’ve enqueued for another wp site, nothing happens. Here’s my functions.php code:

    <?php
    // enqueue child theme css
    add_action( 'wp_enqueue_scripts', 'my_child_theme_scripts' );
    function my_child_theme_scripts() {
        wp_enqueue_style( 'style.css', get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'style.scss', get_template_directory_uri() . '/style.css' );
    }
    ?>

    The site in question is used for my demo purposes and is at http://demoseer.com

    What have I missed here? (And do you know if css entered in the “custom css” filed will remain intact after a theme update?)

Viewing 2 replies - 1 through 2 (of 2 total)
  • And do you know if css entered in the “custom css” filed will remain intact after a theme update?

    Yes, that usually is the case.

    when I try to put the same css into my own child-theme style.css and enqueue it the same way I’ve enqueued for another wp site, nothing happens.

    Here is a few lines from the child theme reference: https://codex.wordpress.org/Child_Themes

    Your child theme’s stylesheet will usually be loaded automatically. If it is not, you will need to enqueue it as well. Setting ‘parent-style’ as a dependency will ensure that the child theme stylesheet loads after it.

    Thread Starter pict3000

    (@pict3000)

    You helped me find the problem by including that codex link. I wouldn’t have ever read it again if not for that. I thought I remembered all of that from my experience with my first site, however I had completely forgotten the part about activating my child theme in Appearance -> Themes.

    All I had to do was activate my child theme and voila…

    Thanks for your help, Martin!

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

The topic ‘onetone Theme's Child Theme CSS vs. Custom CSS’ is closed to new replies.