WORDPRESS THEMES AND plugins typically work separately from each other, coming together only when it comes to implementing features. This cooperation is usually managed by having the correct widget areas available in the theme's template files, so the user can drop the plugin's widget where it should be, or by actually putting plugin PHP code snippets into the theme. Sometimes the plugins will output or activate the functionality by use of the WordPress hooks, which in essence means that the theme only has to comply with WordPress to trigger the plugins. It is all pretty straightforward.
However, there is one case in which themes and plugins collide, and that's when the functions.php file comes into play. The theme file can do more or less anything a plugin can, which means that it can be an optional solution for a publisher that normally would require a plugin. It also means that functions.php can clash with plugins, if not used with caution.
This chapter explains when you should use a plugin and when to use functions.php instead.
When opting for the plugin solution over the functions.php option, or comparing the use of a plugin with a custom hack in the theme, you need to consider the following questions: