Almost every major WordPress theme you install will come with a functions.php file. You can put all your custom functions and code in that file.
Putting all custom coding in the theme’s functions.php allows you to put everything in one place, and to make your theme kind of like the central place to hold such functions.
But is that the best place to put your custom functions in?
WPCandy does not think so. WPCandy recommends that instead of using your theme’s functions.php file, you use a Functionality Plugin instead.
A functionality plugin is basically a simple plugin with all your custom functions in it..
What is a Functionality Plugin?
A Functionality Plugin is basically a very simple plugin which has all your custom code in it.
When you activate this plugin, all your custom code will be live. When you deactivate this plugin, all your custom code will stop working.
Here are some benefits of using a functionality plugin:
- Your custom code does not depend on the theme.
- You can switch themes without worrying about your functions.php file.
- You can have multiple functionality plugins, enabling and disabling each custom code function as you wish.
- You can enable and disable functions easily via WordPress. You don’t have to edit the functions.php file anymore.
- You start treating your custom code like a plugin, which it basically is.
In the end, it may boil down to your preference. Both methods work and produce the same exact effect on the front-end.
Which method is better?
Is putting all your custom functions in a functionality plugin better?
Or should you put everything in the theme’s functions.php file so that the theme can take care of loading those functions properly?
What do you think? And which method do you prefer?
Share your answers in the comments below. Thanks for reading!