Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1365922

    Hi guys,
    This is a silly question but expect many others also ask it.

    I usually use the Quick CSS box in the Enfold control panel for custom CSS.
    I now have WPML installed and the CSS here applied to all translations of the site.

    When I copy the CSS into the child theme style.css file it is ignored.

    Where is the correct location in my Enfold child theme to place custom CSS?

    Should I be using a copy of custom.css from the parent theme? If so – What directory should this be copied to in the child theme?

    The documentation suggests enqueuing a custom stylesheet is this the best method of adding custom css?
    https://kriesi.at/documentation/enfold/add-custom-css/#enqueue-custom-css

    • This topic was modified 1 year, 10 months ago by thinkjarvis.
    • This topic was modified 1 year, 10 months ago by thinkjarvis.
    • This topic was modified 1 year, 10 months ago by thinkjarvis.
    • This topic was modified 1 year, 10 months ago by thinkjarvis.
    #1365926

    Ok I have found the answer.

    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . 'css./my_custom.css',
            array('parent-style')
        );
    }
    • This reply was modified 1 year, 10 months ago by thinkjarvis.
    #1365939

    Hi,

    Thank you for the inquiry.

    styles.css file it is ignored.

    The name of the file should be style.css without “s”. You don’t need to enqueue it because the theme or WordPress will load it automatically.

    Best regards,
    Ismael

    #1365959

    @ismael
    Sorry that was a typo. I have just edited my original post.

    If you place any CSS in the child theme style.css it is ignored or not given high enough priority to overide the theme/plugin css.

    Using my_custom.css seems to work OK for most CSS but some still gets ignored unless it is in the quick css box.

    #1366067

    Hi,

    Thank you for the update.

    The child theme’s style.css file is actually loaded after the custom.css file right before the post-css, so the rules in the file should override the previous styles unless the specificity of the selectors in your custom css rules are not enough. Which specific elements are you trying to adjust in the style.css file?

    Best regards,
    Ismael

    #1366083

    @ismael
    It appears to be a caching issue – Although all caching is off. I think the timestamp on the my_custom.css didnt update right away so my browser was loading a version of the site with the old my_custom.css.

    I am now using the child theme style.css having dequeued the my_custom.css and it is working as expected.

    Sorry this thread has become a bit of a nothing thread.

    I have always used the Quick CSS box but this particular site uses WPML which means duplicated CSS that is used by both language versions of the site if I use Quick CSS.

    I have now emptied quick CSS, copied it all into style.css and dequeued my_custom.css (Disabled the function above).

    #1366113

    Hi,

    Glad it is working as expected!

    If everything is back to normal, shall we close this one? :)

    Best regards,
    Yigit

    #1366126

    Yes please close this out.

    Really pleased this is working actually. I have always used the quick css but due to WPML on this one style.css is the right place for it.

    Cheers All.

    #1366129

    Hi,
    WPML Global Setting in Enfold theme options syncs the options however Quick CSS is excluded so style.css is definitely the right place :)

    Let us know if you have any other questions and enjoy your weekend!

    Best regards,
    Yigit

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Enfold Child Theme: Correct place for custom CSS’ is closed to new replies.