function.php - brain of WordPress theme
functions.php or the theme functions file is a file used by WordPress themes. It acts like a plugin and gets automatically loaded in both admin and front-end UI pages of a WordPress site. This file is used to define functions, classes, actions and filters to be used by other plugin, templates in the Wordpress theme. It can be used to override, add features and extend the functionality of both the theme, and the WordPress installation.
The functions.php file can be found inside themes folder (wp-content/themes/your-theme-folder-name). You can add both built in WordPress functions and regular PHP functions to hooks and filters that are predefined throughout the WordPress core files. Although every theme you have installed on your site has its own functions.php file, only the active themes file will run its code. If your theme doesnt have a functions.php file you can simply create a file named functions.php and add it to your themes directory.
Things you can do with a functions.php file
- Use WordPress actions and filters.
- Enable post thumbnails, post formats, and navigation menus.
- Override and extend the functionality of plugin/theme.
- Create Custom Meta Box (User Profile Meta Box or Post Meta Box)
0 Comment(s)