I’ve tried everything I can think of to fix this issue, but I am totally stuck.
I have created a child theme, and installed it on WordPress. I know that my style.css is working, because during some testing to see what the issue was, I was able to change the name of the child theme and have that show up on my site. I believe that the issue is with the @import, but can’t figure out how to fix.
Here’s what my css looks like:
/*
Theme Name: Accio Child
Theme URI: http://jowerstraining.com
Description: Accio Child Theme
Template: accio
*/
@import url('../accio/style.css');
@import url('../accio/css/animation.css');
@import url('../accio/css/custom1.css');
@import url('../accio/css/custom2.css');
The theme I’m using has several stylesheets, and that’s where I think my problem is coming from. Any ideas on how to resolve this?
Building the site with MAMP so can’t post link, sorry.
We had this same problem when a client wanted to use this theme. We decided to add this to our functions.php file and kickstart the child theme CSS that way:
Note, we did have trouble at first because we were using
get_stylesheet_directory_uri()
which was returing the path to the accio theme folder, and not our child theme folder. We found thatget_stylesheet_uri()
gave us the correct path to our style.css file.what jhoffmcd said worked for me as well, however I had to add “, 99” so my stylesheet loaded last. Thanks jhoffmcd.
Sometimes, the main
style.css
file located at the root of template directory is not enqueued for loading (but just used for the comments to give information about the theme).You should check wether this file is actually loaded or check if the parent theme is using an another css file such as
css/app.css
for instance.If it still not working, you have to check how the css file is enqueued by the parent theme. It should be something like this :
Note that
get_stylesheet_directory_uri()
will return the child theme URI if it exists, butget_template_directory_uri()
will always return the current theme directory URI and will never be overridden.You can try to use wp_enqueue_style function http://codex.wordpress.org/Function_Reference/wp_enqueue_style
just add the code
to your custom.css inside you main theme.