How to Distinguish between WordPress Plugins and Themes
Because themes can contain large amounts of code and add new features or other modifications to WordPress, you may wonder how plugins different from themes. In reality, there are only a few technical differences between plugins and themes; however, the idea of what plugins and themes are supposed to be is quite different.
At the most basic level, the difference between plugins and themes is that they reside in different directories. Plugins can be found in the wp-content/plugins directory of your WordPress site. Themes can be found in the wp-content/themes directory.
The wp-content/plugins and wp-content/themes directories are set up this way by default. It is possible to change both of these locations; however, this is very rarely done. It is something to be aware of if you’re working on a WordPress site and are having a hard time locating a specific plugin or theme directory.
The most important difference that separates plugins from themes is that a WordPress site always has one and only one active theme, but it can have as many active plugins as you want — even none. This difference is important because it means that switching from one theme to another prevents you from using the features of the old theme. In contrast, activating a new plugin doesn’t prevent you from making use of the other active plugins.
Plugins are capable of changing nearly every aspect of WordPress. The jonradio Multiple Themes plugin adds the ability to use different themes for specific parts of your WordPress site. Thus, even the limitation of only one active theme on a site can be changed by using a plugin.
Because WordPress can have only one theme but many plugins activated at one time, it is important that the features that modify WordPress are limited to just plugins, whereas themes should remain focused on the appearance of the site. For you, this separation of functionality and appearance is the most important difference between plugins and themes.
This separation of functionality into plugins and appearance into themes isn’t enforced by WordPress, but it’s a good practice to follow. You can build a theme that includes too much functionality, and you may start to rely on those functions to make your site work, which ultimately makes it difficult to switch to another theme.
The functionality role of plugins does not mean that control over the appearance of a WordPress site is limited to just themes. Plugins are just as capable of modifying the site’s appearance as a theme is. For example, the WPtouch plugin can provide a completely different version of your site to mobile devices such as smartphones.
The WPtouch plugin does this by completely replacing the functionality of the theme when the user visits the site from a mobile device.
There are other technical differences that separate plugins and themes. These are mostly important to developers, but it could be important to know these differences as a nondeveloper WordPress user. Plugins load before the theme, which gives plugins some special privileges over themes and can even result in one or more plugins preventing the theme from ever loading.
The built-in WordPress functions in the wp-includes/pluggable.php file can be overridden with customized functions, and only plugins load early enough to override these functions. Themes support a series of structured template files and require a minimum set of files in order to be a valid theme.
By comparison, plugins have no such structured set of files and require only a single PHP file with a comment block at the top that tells WordPress that the file is actually a plugin. One of the final technical differences is that themes support a concept called child themes, where one theme can require that another theme is present in order to function; no such feature is available to plugins.