Some time back I wrote a blog titled, “Better WordPress Custom Coding – custom functions/css file“. At the time, I was using the Thesis framework (which I really don’t like at all now, especially since Genesis) and the little hack emulated the way in which we referenced a custom_functions.php file containing all our custom code and shortcode. It worked, but it was never a great solution. Looking back at that post, I’m perplexed as to why I suggested yet another file called custom-shortcode.php when it really wasn’t necessary. In fact, consider the whole idea a little redundant. A better way of keeping all your shortcodes and custom functions nice and neat is via a plugin.
Keeping your custom code in a plugin means it’ll never ever break. You’ll only need to activate it once and you won’t have to remember to change any core code with a theme or framework upgrade. Since I’ve provided a bit of shortcode lately (with a lot scheduled over the next month), it only seems appropriate that I put an end to functions.php madness now!
So, with the very basic plugin below, all you have to do is upload it to your plugins directory as you normally would and activate it. Whenever you have a new shortcode or custom function to add, simply open up the file and edit it. If you need to update or create some new CSS code, you can do the same with the customcss.css file.
I’m working on a large shortcode plugin that does about everything you’ll ever need it to. If you want to keep informed of my slow progress, please subscribe to the mailing list.
A few shortcodes are included in the download for your reference and as an example of formatting. If you’re already using any of the included shortcode examples please make sure you delete them. If you have any problems, let me know.
If you liked this article, you may also like: