WordPress offers a clear separation between design, content and functionality. Themes very clearly handle the overall design and layout of a website while plugins offer the ability to add new features to the WordPress installation. Therefore, the question of whether or not your functionality belongs in a plugin or a theme should get a fairly straightforward answer. In practice, the waters get a bit murky when considering both the flexibility of WordPress as well as the divergent intentions of different web developers. Before we examine these nuances though, let’s first define exactly what we mean by “functionality”. Defining Functionality The term “functionality” is a common buzzword that gets thrown around pretty loosely these days by developers, designers and clients alike, but exactly what are we talking about when we reference it? For the most part, just about anybody involved would agree it to be a general term describing a specific feature set that has been introduced into a system. In WordPress, almost all types of functionality can be broken down into four primary categories:
- Core WordPress functionality
- Functionality that enhances existing feature sets within core WordPress
- Functionality that introduces entirely new feature sets unavailable within core WordPress (including third party application integration such as Twitter)
- Functionality that aids a specific theme in handling variables from a design and layout perspective
- Adds to or enhances the actual features of your WordPress site (Site Functionality), or
- Assists you in displaying that information to your audience (Display Logic).
- Registering sidebars and widgetized areas
- Registering new WordPress menus
- Custom conditional logic inserted into the Loop
- Post thumbnail scripting references such as TimThumb
- Because they’ll be running regular seminars, the client would like some form of an event management system
- The client would like to make sure that each of their properties is displayed in a constant, intuitive way that leaves room for multiple photos—the number will vary per house listing
- The client would like to show six featured properties that they select on the home page in a specific format
- The client would like Facebook comments integrated into their site so that visitors can easily share potential homes with their friends
functions.php
file, but it’s important to note that it could be defined with a functions file initialized within the plugin system.
In many ways, this makes a touch more sense as it keeps a clean separation between site functionality and design components, but as of this writing initializing the array within the theme’s functions.php
file is the clearly the most common practice. It is certainly a gray area.
Reason #2: Specialized Page Templates
Occasionally, it becomes important to create a special page on a WordPress site that simply performs a specific function. Perhaps you are iframing something from another site, or pulling in some type of custom functionality that isn’t particularly conducive to working within the constructs of the standard WordPress page template and content editor.
When this is the case, a common practice is to register a new page template with the standard WordPress syntax in the template file, and then include the functionality directly within that particular page. In this instance, the functionality is not portable to other sites at all, but often it is done in a situation where that is not necessary.
Reason #3: Protecting the Client from Themselves
As much as we’d all like to believe that WordPress is a bulletproof system that clients are unable to break, we all know that isn’t wholly accurate. Occasionally, there is a very good reason to hard code something.
Let’s say you have a client who needs to edit the sidebar on his or her website, but continually adds to or edits the wrong item. In this instance, it can be useful to hard code simple elements into the sidebar that you are reasonably sure the clients themselves will never need to update on their own, guarding against the possibility that they might accidentally delete it.
Examples of things that might be hard coded could include an email opt-in box, or perhaps social media connection buttons.
Reason #4: Developing a Specialized Product for a Specific Industry
There are many theme developers out there who build targeted WordPress themes tailored to specific industries. These themes lack a certain amount of flexibility, but the upshot is that for the target market they serve additional flexibility is unnecessary. Examples of this include real estate specific themes, product review themes, or question-and-answer aggregation themes.
Reason #5: Time and Budget Considerations
It’s sometimes faster to code something directly into a theme than it is to make it modular and use a plugin as defined as best practice. When time is a factor or your client has a tight budget you need to adhere to, an argument can be made that a legitimate reason exists to cut corners and code site functionality directly into the theme.
It’s important to note that this is certainly not best practice, but it is a reason to do what you need to do to get the job done.
What’s the Bottom Line?
The question of where to house your site’s functionality is like just about anything else … there is a straightforward answer based on fairly finite rules, but you can always come up with the justification to go your own way if needed.
Best practice is to determine which functionality is best described as display logic and which functionality is best described as overall site functionality, with display logic being added directly to the theme and site functionality being enveloped within the plugin system.
Is this reflected in the way you work?
Frequently Asked Questions (FAQs) about WordPress Plugins and Themes
What is the main difference between a WordPress plugin and a theme?
A WordPress theme primarily affects the visual layout and design of your website. It determines the overall look of your site, including the color scheme, typography, and layout. On the other hand, a WordPress plugin is a piece of software that adds specific functionality to your website. It can range from adding a contact form, SEO tools, to e-commerce capabilities. While themes shape the appearance, plugins enhance the functionality.
Can I use multiple themes on my WordPress site?
WordPress does not support the use of multiple themes simultaneously on a single site. However, you can install multiple themes and switch between them. It’s important to note that switching themes can significantly alter your site’s appearance and may require additional configuration.
How many plugins can I install on my WordPress site?
There’s no set limit to the number of plugins you can install on your WordPress site. However, it’s crucial to remember that installing too many plugins can slow down your site and potentially lead to conflicts. It’s best to only install plugins that you need and ensure they are from reputable sources.
Can a WordPress plugin affect my site’s design?
Yes, some plugins can affect your site’s design. For instance, a plugin that adds a contact form or a photo gallery will have a visual impact. However, most plugins are designed to add functionality without altering the overall design set by your theme.
Can I customize a WordPress theme?
Yes, WordPress themes are highly customizable. You can modify them using the built-in WordPress Customizer, which allows you to tweak various elements like colors, fonts, and layouts. Some themes also come with their own set of customization options.
What happens if I deactivate a WordPress plugin?
When you deactivate a WordPress plugin, the functionality it adds to your site will no longer be available. However, the plugin’s settings and data are typically retained, so you can reactivate it later without losing any information.
Can I use a WordPress plugin without a theme?
No, a WordPress site requires a theme to function. The theme provides the basic design and layout of your site, while plugins add specific features and functionality. Without a theme, your site wouldn’t have a visible interface.
How do I choose the right WordPress theme?
Choosing the right WordPress theme depends on your specific needs and preferences. Consider factors like design, responsiveness, customization options, compatibility with essential plugins, and the level of support provided by the theme developer.
How do I know if a WordPress plugin is safe to use?
To ensure a WordPress plugin is safe, check its reviews and ratings, the number of active installations, and when it was last updated. Plugins from the official WordPress Plugin Directory are generally safe as they undergo a rigorous review process.
Can I create my own WordPress plugin or theme?
Yes, if you have knowledge of PHP, CSS, and HTML, you can create your own WordPress plugin or theme. However, it requires a good understanding of WordPress coding standards and practices. There are also various tools and resources available online to help you get started.
A seasoned Wordpress expert, Mick is a partner at Superfast Websites with James Schramko, as well as the go-to web development consultant guru for several of the top internet marketing specialists in the world. Aside from an obsessive passion for the ever-evolving technologies that bring the Web to your local browser or device, Mick enjoys music, outdoor activities, photography, spending time with his amazing wife, and observing different business models in action. Follow Mick at fbmick.com.