Since we develop a lot of plugins (mostly for WooCommerce) and do some custom development, we get a lot of questions on best practices or recommendations for adding functionality to a site. Many times we’ll provide suggestions or guidance and tell people they should create a custom plugin, which prompts the question, “Couldn’t I just modify my theme template or buy a theme with this built-in this instead? I don’t want to have too many plugins.”
It’s better if you use plugins. Please trust us, but we’ll tell you why.
Themes are cosmetics. Plugins are plastic surgery. Or something like this anyway. Themes should solely be reserved for aesthetics and the way your site looks. They’re a skin, and are meant to be interchangeable. Plugins change site functionality. If you want to change the way something looks (button size, color, link decorations), then change your theme.
But if functionality is something you’re looking for, such as the ability to add product data to each product page, then you’re far better off using a plugin.
Themes vs Plugins
Design cycles through trends. In a couple years, you’ll probably think your website looks outdated, themes have gotten a lot cooler, or you may just want a fresh look. Should be easy enough, right? Drop a new theme in, tweak it, or create a child theme and make some changes. It should be this easy. However, a lot of people make some heavy modifications to their themes, and changing the way the site looks becomes an issue where functionality may change.
This is what’s driven the change towards more plugins and less built-in to themes, which we support. The less functionality designers build into a theme (which users may not need), the more stability and better performance the theme can provide (and the easier it is to update). This Occam’s Razor approach to development provides better themes without bloat and ensures best-practices for site building as code that’s not needed isn’t included.
So why use plugins? They gives you the flexibility to change the way your site looks by swapping themes without every worrying about losing functionality or something you’ve built for the site. Your data and functionality then belong to your site, not your theme.
Plugins can usually allow for more customization than theme changes as well. For example, if you’re creating a change to your theme that modifies a lot of pages or content, this might be something that you want to put into a plugin. That way, you also gain the flexibility to exclude some pages or modify this drastic change on a per-page level for maximum customizability.
For example, what if you want to disable comments on all pages except an FAQ page (and use comments for the Q & A)? Themes will usually take an all-or-nothing approach since they’re using templates, while a plugin allows you more control over site functionality.
Granted, it might not be easy to determine what’s functionality or just appearance. We know. If you’re not sure, err on the side of using a plugin. Here are a couple of sample cases to help you determine when to use a plugin.
Sample Use Cases
I use a lot of themes made by WooCommerce because code quality is great and they’re relatively easy to modify. However, WooCommerce builds a lot of shortcodes into their themes (for example, shortcodes to create a two-column layout). For many people, they think this is an awesome addition to the theme, since it changes the way content is displayed.
However, I actually dislike using built-in shortcodes, as I end up with a lot of
[[twocol_one]] shortcodes displayed in the middle of a page if I change to a theme from someone other than WooCommerce, and use a plugin for shortcodes and layout changes instead. Not sure what should be in a theme or plugin? Ask yourself the question, “Would I want to take this ability with me if I change the way the site looks?”
Here’s another case. One of our products, the WooCommerce Tab Manager, adds extra product data tabs to WooCommerce product pages, and allows you to change and rename the default tabs. Could you add an extra tab to product pages by changing a theme instead? Yep. However, that change would basically “paint” the tab onto your product pages.
Doing this with a plugin instead gives you far more flexibility. First, if you change your theme, you won’t lose all of the extra tabs you’ve created. However, the larger benefit for me is that you can then change these tabs on a per-product basis. This allows you to change the tab content or embed shortcodes for each product. Or hey, leave the tabs the same for all products – but at least those tabs are coming with you in a theme change.
Now the Tab Manager does a lot more than that 🙂 . In addition to global tabs, you can edit tabs on a per-product basis, create default layouts, and add tabs to products on an individual level. However, this is a good example as to why you’d want to reserve this kind of change to a plugin rather than modifying your theme – you gain flexibility by building it into the site structure rather than the façade.
We always encourage you to use a plugin wherever possible. Sure, changing a theme might be quick and easy. However, using plugins can save you a lot of time down the road, and builds the changes into your site structure rather than painting them onto the skin of your site.