What is functions.php
functions.php file is called the brain of WordPress theme. It is a php file which exists almost in every theme (wp-content/themes/your-theme/functions.php). It adding features and extends the functionality of WordPress and behaves like a plugin. You can say that
functions.php file controls the functions of a WordPress theme.
The use of functions.php
functions.php file used to define PHP functions, WordPress functions and classes. You can add PHP functions and WordPress functions to WordPress hooks and filters inside
How to create functions.php
If your theme haven’t
functions.php file, you can easily create it by going to your theme files directory
wp-content/themes/your-theme and create new file with the name of functions.php
functions.php in child theme
You can add
functions.php file separately to your child theme, in this way you can extend or replace the parent theme’s functions.
functions.php vs plugin
The difference between WordPress plugin and
functions.php is that each theme’s
functions.php file loaded automatically by activating that theme and applies only on the current activated theme, while plugin loads when it is activated using plugin section and applies to all installed themes.
Here are a few tutorials for you to read next:
If you find this tutorial helpful, then please Subscribe to our YouTube Channel for video tutorials, and share this article on social media.