Where I store custom code

Here are the various places I store my custom code for WordPress and why!

Code block

Even though many people would say the default code block is not a good place to store important WordPress code due to performance issues, I seem to find myself using it more and more everyday. Why? Simple - caching! If I were to store custom code using other methods compared to this, then I would go through a caching nightmare in which only when I do a hard browser refresh, will I see the changes.

Default stylesheet

Oxygen Builder includes a feature to create as many stylesheets as you require and these CSS files get stored and called in an optimised fashion by default. Now it probably isn't good to have multiple stylesheets, but I cannot stress how easy it makes organising important CSS code. Especially if you have a lot of selectors you wish to style using non-visual methods. In addition, as mentioned with using default code blocks, you virtually never run into caching issues as everything is updated in real-ttime.

Plugin

Probably 90% of people use a plugin like Code Snippets due to how easy-to-use it is and how powerful it is. However, I could never stop creating my own custom plugin to store my custom code. Of the 3 methods mentioned in this post, this by far is my most favourite method. For example, I have a plugin for initialising Clipboard.js and another for Highlight.js. Could I put it all into 1 plugin? Yes. But honestly there is something so satisfying about having your own custom plugin to add extra functionality in separate blocks. Not forgetting that it makes it easier to add functionality across multiple WordPress installs. The final reason is that it looks very professional and I guarantee anyone that is crawling through your website will think you really are a whiz.

Want to quickly create a plugin to store your custom code?
You can download a free barebones plugin from here and customise as you require.

Want to be notified of new posts like this?

Sign up to be notified of new posts using the form below. Email addresses are used for the sole purpose of sending once-in-a-while email notifications and nothing else. I promise I don't spam!