Add custom CSS to WordPress websites
Sometimes all you need is a simple plugin to add custom CSS to WordPress websites. Heaven knows there’s no lack of them in the WordPress repository.
I prefer to keep all CSS in the theme’s folder but sometimes I need to add some custom CSS on-the-fly without having to go through the trouble of updating the actual theme code. Maybe the client has reported a visual anomaly or I spotted something off while browsing their website. Either way, it’s much easier to log into the WordPress admin and add the CSS code. Migrating it to the theme can be done at a properly scheduled time.
Exit: PC Custom CSS
Years ago I found PC Custom CSS. I loved that it did only one thing and did it well: add custom CSS to your website. Instead of adding your code inline, it would actually write the code to an external file and link that file in the HTML. Back then that was exactly what I was looking for and have been using it ever since.
Until it stopped working. One of the web hosts I use would not allow the plugin to write the file on the server. After doing some investigation I realized that PC Custom CSS was writing the CSS file to it’s own folder in the plugins
directory instead of uploads
. Not very advisable… And taking into account the fact that the plugin has gone 5 years (as of writing) without an update, it’s probably best to seek out an alternative.
Enter: Simple Custom CSS and JS
After a quick search I found Simple Custom CSS and JS. This WordPress plugin allows you to add CSS, JS and HTML snippets of code to your website. It gives you the option of adding the code in the header or footer as well as including it inline or as an external file. Very nifty!
And the plugin seems to be actively updated. As of writing it was updated just 3 days ago.
The free version is sufficient for my needs. There is a Pro version that includes minification, preprocessors, the ability to include/exclude the code on certain pages etc…
What about Jetpack’s Custom CSS/WordPress Customizer Additional CSS?
For a while, I was using Jetpack’s Custom CSS module (which was eventually absorbed into WordPress’ Customizer) because it supported preprocessors. I started to moved away because I found the CSS editing to be buggy. I stopped using it completely once the Custom CSS module became part of the Customizer, I have a love-hate relationship with the WordPress Customizer: I love the idea but hate how laggy it can be. On several occasions the browser tab would crash because the Customizer used up too much memory. Chances are this was just as much the fault of the theme being used but I don’t have the time or patience to troubleshoot when there is no shortage of plugins to add custom CSS to my website.
Social Media Links