Custom Plugin – When to use functions.php and When Should You Use a Plugin?

Custom Plugin – When to use functions.php and When Should You Use a Plugin?

What’s functions.php file? It is a file that stores all the functions belonging to the theme you are using. Many developers lean towards adding customized functions to their themes.

The file is found in the theme’s folder. There are several pros and cons to using functions.php on your WordPress website.

When to Use functions.php?

When you want to alter basic or simply aspects of the functionality of a theme, you can use functions.php. For instance, if you want to change the font or change the way the content is displayed, functions.php can be used.

You can also use it when you are making changes to the parent theme by using the child theme. You can add an additional stylesheet to your theme and even add a translation file if needed. Functions.php essentially allow you to make changes that are specific to a theme.

Why You Should Not Use functions.php?

For starters, you might lose all the changes you make to the parent theme when your theme is updated. Many developers still use the parent theme to make changes to their themes, which eventually is of no use once the theme is updated.

You won’t be able to create custom shortcodes or add tracking codes. These can only be added independently from your theme files.

Up to date and most comprehensive list of free responsive WordPress themes are available to download in 2018 that will help you create awesome looking sites with great functionality.

Let’s talk about plugins. Plugins ideally solve minor problems and make certain functions easily executable on your website.

They can take on the biggies like SEO, spam, analytics, and other important aspects of your website and give you a more enriched user experience.

When to Use Plugins?

As mentioned earlier, plugins solve the problems and help with the functionality of the website. Plugins don’t lose your data like functions.php might.

Functions.php solve the smaller issues like font and display, whereas with plugins you can track the performance of your website and even boost SEO.

If you want to create a plugin from scratch to store custom codes, you simply need to create a .zip file which will have a .php file and then install the plugin like you would any other plugin. Activate it and you have your custom made plugin.

There are some developers who swear by the funtions.php use and some are with plugins. Each has its own specific uses and needn’t overlap.

The idea is you need a location to store your custom codes and whether or not it is safe in that location is when you need to think if a plugin will be better or functions.php.

With plugins, you can simply deactivate in case you need to update a theme or even change a theme on your website. With functions.php, you may not have that luxury.

The codes would be in the parent theme folder or the child theme one. Either way, if you’re going to change the theme all together, it’s best not to use functions.php.

Of course, if the font needs to be changed you can do it. You can always change the theme and re-do it on that one too.


Web Designers & Developers In West Lakes , South Australia