WordPress Web Development: Functionality in WordPress Theme or Plugin?

Should you put functionality in a WordPress theme or WordPress plugin?

It’s a very popular and quite controversial question for all WordPress developers out there. Whether your answer is WordPress theme or plugin, you have some points to believe in your approach.

However, putting functionality in a plugin and only letting the theme handle the appearance of your website seems to be “the more right answer”. I’ll tell you why by running through these parts:

  1. Define functionality in WordPress
  2. The debate between Theme and Plugin functionality
  3. Why does functionality belong in a WordPress plugin?
  4. How to start moving functionality into a WordPress plugin?

Get a cup of coffee, or grab some popcorn, and here we go!

What’s functionality in WordPress?

Functionality by definition is a term describing a range of operations that can be run to serve a purpose in a system. WordPress has core functionality which shouldn’t be edited, no matter what, and as they often tell you: “Don’t reinvent the wheel”.

Also, there are functionalities that help you improve WordPress core features, or bring totally new features into it, or support a WordPress theme regarding its design and layout.

A quick note for you: functionality that exists to improve the WordPress core and to address brand new features belong in a WordPress plugin. Similarly, functionality that serves the purpose of supporting a theme’s appearance should belong in that theme, like scripting to display a piece of content within the theme.

The common beliefs about functionality in WordPress themes and plugins

build-easy-to-use-wordpress-for-client

There are two schools of thought when it comes to the functionality of WordPress.

The first one supports the idea of bringing functionality into a WordPress theme, and the other one believes that any non-theme related script should be brought together into a WordPress plugin.

The former thought is easily seen through the theme market on Themeforest. And the latter thought can be seen through WordPress.org as well as WordPress.com themes. If you’re a frequent visitor to both marketplaces, it’s not hard to realize that the majority of themes on Themeforest are always packed with many different functionalities as well as unlimited customization options.

This is not a coincidence. Since it’s the demand of the market, the providers (WordPress developers) must make their themes that way. The customers on Themeforest are not usually web developers; or if they are, I assume that they buy a theme from Themeforest because their client wants that theme. And these consumers always want to purchase a theme that can let them literally do anything they want.

They have the habit of deciding to buy a theme based on its demo. The more functionalities and capabilities a theme has, and shows via the demo, the more likely a consumer will open his wallet for it. You may question: why would they want to buy themes overweight with functionality like that?

It’s because end-users want themes that are convenient and there’s less work for them to do. Like, installing a theme and boom, they have a nearly ready-made website. They don’t want to go researching and picking a plugin for each of their needs. They want themes that only require one click to customize everything.

That is the reason why there’s a huge trend for developing bloated themes which are full of plugin’s functionalities – it’s for pleasing the crowd’s demand and it’s no surprise that these themes sell way better than the pure themes that let plugins handle the functionality they need.

However, this trend is now on a downturn. The golden age for bulky themes has passed. The theme market on Themeforest now is saturated.

If you are theme developer who is trying to making a living on Themeforest, I have a bad news for you. It has become harder and harder for theme providers here to produce new themes and expect good sales in the long term because there are already big guys with thousands of sales who always stay on top because of their authority and popularity. You know, when everyone is racing to add more functionality in a theme, it gradually reaches the point where no more new features can be added. And, these themes are in the same category regarding what they can do.

That’s the foreseen and complex problem Themeforest theme providers are now facing. And they’d better find a new way for to-do-it-all themes.

For those who provide themes which are cleanly-coded and actually let plugins handle the functionality, there are many opposing ideas too. When relying on plugins for a website’s functionality, you should understand that there are many risks. For example, unexpected problems like crashing, slowing down the site’s speed, hidden non-validated code, malicious scripts, viruses, and open doors for hackers, etc.

One more thing, plugins sometimes might be abandoned by the provider and upgrade stop. So you’ll need to find an alternative. For all these reasons, many people believe that inserting functionality into a theme is better than activating a plugin.

Why should you start moving functionality from WordPress themes to plugins?

Firstly, let’s take a look again at WordPress and its inception. WordPress initially was not designed for themes to bear any website functionality. There was a clear borderline for a theme’s job and a plugin’s job.

More importantly, keeping functionality separated from a theme benefits theme authors more. There’s much less restriction in making a theme and you have more room for your creativity. And a simple, cleanly-coded theme always brings a better user experience.

By bringing functionality to where it should be, you’re exercising WordPress best practice. Moreover, stripping all the complicated functionality which requires additional code helps hasten your theme development.  Plus, it also lightens the updates for a theme when you can leave all to plugins.

For instance, if you want to update just one feature in the theme, you might have to update the whole theme if you have inserted the functionality in the theme. But, when you separated functionality between theme and plugin, you only have to update one plugin for a simple feature update.

Surely there is less work for theme authors. Now that you have more time, you can invest more in new products or improving current ones.

wordpress-funtionality-theme-plugin-3

How’s about the downside of using plugins? We discussed in the previous part that depending on plugins too much might make your site load slower and be vulnerable to security attack? Well, I don’t think that’s the big problem. There are definitely many bad plugins out there, but there are also a ton of great ones.

You can absolutely choose a plugin that serves your needs and does no harm. It’s so easy to choose a good and safe plugin. We all know the reliable plugins from articles, and with help from the community for its recommendations.

How’s about the fear that if you are using too many plugins, your site will load no faster than a snail?

That’s not always true. Have you ever asked the same question about a theme with lots of functionality? If you have 10 plugins and each takes one second every page load, then they would take exactly the same time when you put them in themes. Your argument is invalid now.

Packing a theme with features and functionality that should be included in plugins is going reverse to the simplicity of WordPress. The benefit of using plugins is that you can activate and update them individually without messing about with the whole theme. It’s also safe when you want to switch theme. Your site’s functionality is all still there in the plugins. You don’t have to recreate them.

Additionally, with plugins you have your desired functionality within minutes instead of custom coding which may steal from you a week. Not to mention that many plugins let you customize them at a certain level. Plugins allow us to build our websites quickly and affordably.

If you defend the idea that putting functionality in a theme helps you pour more uniqueness into it, then I’m going to tell you this: the uniqueness of your theme should lie in its creative layout, the color scheme you use, the visual effects, and other design elements.

One of the strengths of WordPress is keeping functionality separate, so don’t you want to go with the original idea? If you want to be successful in the long term in any WordPress market place, you will need to understand that. Simply put, the latter school of thought is becoming more popular among theme builders.

How to keep the functionality of WordPress themes and plugins separated?

wordpress-funtionality-theme-plugin-4

Looking at the root of the problem, starting from WordPress’s increasing popularity and the aggressive competition among marketplace theme providers, the trend for putting functionality into themes was triggered. So, to solve this headache, we must re-educate the consumers. That will not be an easy task, so the key is in theme author’s hands to develop clean themes as well as to keep data portability.

How do you achieve this task? As cited in Sarah Gooding’s article about this matter, Justin Talock’s advice is:

If you’re a theme developer who is looking to remove functionality from your products and offer it in the form of accompanying plugins, you’ve got your work cut out for you. Tadlock’s advice: “Just do it. Make sure you offer your users a fairly easy transition, at least as easy as these types of transitions can be.”

And the best way to separate functionality between theme and plugin, besides understanding clearly the purpose of it (please take a look again at the functionality’s definition), you should think about how you will need that functionality in the long run, as suggested by Ryan Imel of  WPCandy:

To decide what belongs in a theme’s functions.php file and what belongs in a functionality plugin, think long term. Rather than thinking about how your website will look and behave this week, think about how it will look and behave five years from now. With few exceptions, I bet all of our sites will have new and upgraded themes in five years’ time.

If a feature is theme-specific then it should go into your theme’s functions.php file. If the feature interacts with content of any type, it should be in a plugin.

In case your client asks you to make something specific for their them, if you think it’s right to do so then go ahead, because sometimes there’s a specific requirement that the theme must have. It’s distinctive to your client’s website so you should bake it into the theme, especially if you realize that if you use a plugin to fulfill your client’s need, you’ll have to correct the plugin someone else wrote.

After all, keep clear in your mind the difference between a functionality that serves design logic and a functionality that is for a site’s functionality.

Ending thoughts

The best way to extend the functionality of WordPress further does not lie in baking all the possible functionalities into a theme. To go far with WordPress and to be successful with it, I believe the right way to go is to master the simplicity of WordPress as well as knowing how to keep themes and plugins separated.

Have you got this matter clear on your mind? I hope that with this article, you have the reasons and some take-away to build better, more simply-coded themes from now on. And I’m very happy if you share your thoughts below!

 

This blog was written and published on WPDemobuilder.com in Oct 2014. Featured image taken by me 😀

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s