Randy and I had a fun discussion the other day about the programmatic differences between themes and Plugins. For the most part, anything you can program within a theme can be programed into Plugins, and anything you can program into Plugins can be programmed in a theme. So how do you decide which to use for a particular purpose? The answer is simple—PLUGINS!
As we tweaked our site’s theme, Boldy, we had to decide on whether to strip functionality that we didn’t need out of the theme, replace functionality with other Plugins, or move functionality into new Plugins for eventual release to the WordPress Plugin Directory for community benefit. For example, the “Share” button on the bottom of blog posts (below). The design of the button was part of the original theme. We moved that functionality over to a plugin, which could potentially be replaced with something such as ShareThis or AddThis. We decided to make this a plugin, because it represents functionality more so than page design, and could be useful to other sites—not just ours. We did the same thing with the contact form that was part of the original theme.
Other examples of functionality built into the theme we found were (1) Smooth Navigational Menu, (2) prettyPhoto lightbox, (3) Twitter integration, (4) Cufon font smothing, (5) Nivo Slider, and (6) custom search box. All of these features should ideally be built into Plugins, not kept within the theme. We might get to moving those someday!
Why should features go into Plugins rather than the theme? Because Plugins have certain advantages over the theme:
- Plugins can be individually enabled or disabled.
- Plugins can be individually updated, and are likely to have more exposure since they can work with anybody’s website, thus there will be more user testing and software updating available.
- Plugins are more likely to be coded well—otherwise they would break on other themes.
- By building functionality directly into a theme, one needs to develop a theme control panel, and this need is easily replaced by the built-in WordPress plugin management interface.
So why do themes build functionality directly in (ah-choo, the wrong way)? It’s the design of those elements. Going back to the Share button example, this plugin would typically need to come with many different design choices in order to work well with many theme styles. So often times WordPress site administrators stick with the functionality built into their selected theme, not realizing how poorly coded or out of date it typically is, just to have it match their style as “intended” for their site.
Take it from us—use popular or trusted Plugins for needed functionality whenever possible, and use themes that do not try to integrate much functionality. The ideal theme is nothing more than a stylesheet with images and some very basic PHP looping logic. A clean theme will perform well, be more secure, and be more flexible with plugin functionality. It is both Plugins and themes, among other things, that make WordPress so powerful. Let’s not get them mixed up!
Thank you for taking the time to read this post. Note that we really appreciate feedback about what we’ve written as well as what topics you’d like us to discuss in future posts so please do let us know.