![Check out Enfold](https://kriesi.at/wp-content/themes/kriesi/images/banner-enfold.jpg)
Tagged: child theme, enfold
-
AuthorPosts
-
September 22, 2022 at 7:13 am #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, 11 months ago by
thinkjarvis.
-
This topic was modified 1 year, 11 months ago by
thinkjarvis.
-
This topic was modified 1 year, 11 months ago by
thinkjarvis.
-
This topic was modified 1 year, 11 months ago by
thinkjarvis.
September 22, 2022 at 7:33 am #1365926Ok 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, 11 months ago by
thinkjarvis.
September 22, 2022 at 9:27 am #1365939Hi,
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,
IsmaelSeptember 22, 2022 at 10:32 am #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.
September 23, 2022 at 9:47 am #1366067Hi,
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,
IsmaelSeptember 23, 2022 at 10:43 am #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).
September 23, 2022 at 1:22 pm #1366113Hi,
Glad it is working as expected!
If everything is back to normal, shall we close this one? :)
Best regards,
YigitSeptember 23, 2022 at 2:17 pm #1366126Yes 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.
September 23, 2022 at 2:32 pm #1366129 -
This topic was modified 1 year, 11 months ago by
-
AuthorPosts
- The topic ‘Enfold Child Theme: Correct place for custom CSS’ is closed to new replies.