New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom CSS in Child Theme does not work #261
Comments
Same bug for me. |
same here |
This is likely the cause: 7299ab6 Be sure to enqueue your child themes stylesheet. See: https://codex.wordpress.org/Child_Themes |
@todorchrisov @opportus @S4Mi sorry about this. To fix, open /inc/functions/setup.php and find;
after it please add
That should fix the issue. Let me know if it does and I'll push the update to .org. |
If I understand what you say, the code should look like this:
For me, it just loads the child theme style after the parent style, conflicting each other. If I remove this line:
The storefront customizer style does not load anymore. |
I think it is expected behaviour that the parent css is loaded. We have to load the parent styles for the RTL css to be included. If you don't want to include the parent css you should dequeue that manually in your child theme. We can document this.
It won't do. A lot of the styles are appended to that stylesheet. If it's not there, the styles don't get appended. TBH, removing the parent css entirely isn't really recommended. At that point you'd probably be better off creating your own custom parent theme. |
I update storefront (parent) delete wp_enqueue styles in my child theme, link rel='stylesheet' id='storefront-style-css' ................ I can design woo-commerce styles via css in my child-theme, in a perfect world :-) child-css is loading last, after all woo-commerce styles and I agree, child css shouldn't be enqueued from parent theme => in a perfect world |
Thaks for all your efforts and feedback, @jameskoster ! Regretfully, I am totally lost with this new custom code. I pray for an update which will revert back the old functionality of Storefront where everything was nice and easy with custom css. |
Thanks @MonikaTS. OK, looks like we might need a new function here. I'll update shortly. |
* Now the parent CSS is loaded regardless in `storefront_scripts()` * A new function is added (`storefront_child_scripts()`) to enqueue the child theme CSS. The new function is required so that the child CSS can be loaded _after_ all the other CSS.
@MonikaTS would you be able to give that a try? ^^ |
yes what should I do :-) |
The child theme CSS should now be loaded after the WooCommerce css. |
:-) you are the hero of the day => and it is monday (=murpheys day) |
OK. I will leave this a few hours to give others an opportunity to contribute. Otherwise I'll prepare the update tomorrow morning. |
If I dequeue it manually from my child theme with:
The style id "storefront-style-inline-css" (which, I think, is containing the storefront customizer style) still doesn't load...
in the storefront setup.php. So if that "issue" was in fact an expected behavior (because it's not very clear to me), what would you suggest to us for adapting our child themes to that new code in function storefront_scripts(), expecting customizer and child styles to load properly as in 1.5.1 ? |
@opportus if you want to disable the Storefront core CSS but still have the Customizer controlled css load you'll need to attach it to a different stylesheet. You can see how it's included in core here; https://github.com/woothemes/storefront/blob/master/inc/customizer/display.php#L206 Your best bet would be to plug that function ( |
@jameskoster I tested your fix in comment 4 and it does work. However, since this is a new conditional in
So, it would be a 2 step fix for me:
|
Thanks @jameskoster.
This will probably fix the case for those of us not enqueuing the storefront stylesheet in our child theme. However, I wonder which direction will take the next update... do we have to adapt to this new behavior which, from what I understand, is the good practice, or will you revert back to the 1.5.1 behavior ? |
I'm not sure I agree with logic of removing the child theme functionality from |
In any case, for those still struggling, this code from the same page I referenced above in your
|
Closing this, should be fixed by 17b69e6 |
Thank you smcjones it's amazing how little correct info is out there. |
I see this is an old post and closed because it has supposedly been fixed, however I just installed storefront 2.0.5 and I am having the same issues of the colors reverting back to default on my child theme. Has this issue not been fixed in the theme yet? Secondly, I see there is a fix by pasting code into the setup.php file, however I cannot seem to find that file on my server with my wordpress/theme install. Where does this file exist? I don't seem to have the path referenced in this post. Thanks for the help! |
Since the release v2.0, the theme has been heavily restructured, no setup.php anymore. But you can find the enqueuing style functions here. |
Thank you for the reply. So as I understand it, this issue was not fixed in the latest version of storefront and I need to update code in the class-storefront.php to get my child theme to work properly? If that is the case, then do I copy and past all of the code in the link your provided or just a snippet? Please be specific so I fix the problem and don't make it worse. Thanks for the help! |
I didn't mean that will fix your issue. Anyway you shouldn't touch the Storefront original files since your modifications will be deleted the next update. |
I have to disagree that it is working, which is the reason for my post....unless I have a special case here. I created a storefornt child theme and my colors are reverting back once I view my site. I did not have this issue until I created the child theme. I fixed the header by modifying the .css file but I would rather not have to do that for all of the colors (backgrounds, links, texts, etc.) on my site. Is modifying the .css file that only fix? If so, is there a list somewhere of all of the css code to make these modifications? Thanks for your help! |
@ArcodeFire, are you manually loading your child theme main CSS file ? If that's the case, try deleting the line enqueueing it in your functions.php. Also are you sure the Customizer settings are not overwriting your custom CSS ? If that's the case, modify first what you can modify in the Customizer, then make the rest of the changes to your custom CSS. |
The only thing I did was click the Create Child Theme button on the Storefront 2.0.5 theme. Ever since then, none of my color settings have been sticking. |
I don't understand where do you see this button ? |
I don't have this button, are you sure it doesn't come from a tier unupdated plugin ? |
This is the auto generated code in my style.css file This is the custom code that I added to the custom css section to get my background to stay: Not sure what to do at this point... |
This is from the Wordpress theme page. Click Themes under Appearance and then click Theme Details on Storefront and you will see the button on the bottom. This is the only way I know how to create a child theme. Is there another way? |
Thank you for your continued help (sorry, I am a bit new to WP).
I do not see any enqueueing lines in my /themes/storefront/functions.php file. Am I looking in the right file? Why do I feel like I have a completely different version of WordPress than you!? |
@ArcodeFire Github is for BUGS, not support. But before @jameskoster Locks and Limits this issue (because some of us ❤️ to see closed issues!), let's give this one last try 👍 Go to your admin area, WooCommerce > System StatusNow click the button labelled "Get System Report"Now click the button labelled "Copy For Support"(which again is not what GitHub is for. That IS what https://wordpress.org/support/theme/storefront IS for) |
That child theme creation button is not coming from WordPress core.
That is bad and will not work for Storefront. If you're running a child theme, Storefront automatically recognises this an loads the stylesheets for you. So remove that line.
Switching themes resets your Customizer settings, FYI. I'm locking this, please post in support if you're still having problems :) |
After upgrading to Storefront 1.5.2 all my custom CSS tweaks in my child theme are not working anymore.
The text was updated successfully, but these errors were encountered: