Discover in this tutorial how to keep the stylesheet (CSS) in any Genesis Framework child theme updated at all times by using code.
Have you ever gone crazy because the CSS changes you make in the stylesheet are not reflected on the web?
Or worse, you see them but your client doesn’t… Arggg!
If you develop child themes, or at least like to fiddle with them, this is quite common.
Most of the time, the cause is the cache, which honors its name or remembers an earlier version of the style.css file so it doesn’t have to constantly load the page.
In order to optimize the loading speed this is very good, but not so good if you are in the middle of creating and modifying styles.
How to solve the problem? You could:
- Clean the browser cache every time you make a CSS change.
- Replace the version of the style sheet with each variation.
- Or the simplest option, give order it through code to do it automatically.
I recognize that my favorite is the third one. It is always very useful for me and I’m sure that it can save you a lot of annoyance too.
Snippet to keep always updated the style.css version in a Genesis child theme
Add the following fragment at the end of the functions.php file:
To see this and another 1097 code snippets of this website, login or subscribe here.
It’s that simple.
You’re no longer forced to clear your browser cache continuously.
Conclusion
With a simple snippet you can get your Genesis child theme to always load the latest version of the style.css.
It’s a simple and practical trick for WordPress designers and developers. Especially when you’re in the middle of creating a website.
And it also improves the customer experience, since you’re not forced to clear your browser’s cache to assess changes. You can say goodbye to so many misunderstandings…
But remember to remove the snippet when you are done with the changes so that the web speed benefits from the cache.
Any questions? Let me know in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉