What is functions.php file in WordPress theme?
The functions.php file kind of hart of a WordPress theme. This file responsible for various feature registration. Let’s see
-
register_sidebar() : Responsible for registaring sidebar
-
wp_enqueue_style() : Load stylesheet into theme.
-
wp_register_script() : Load JavaScripts
-
add_theme_support() : Registers theme support for a given feature. etc
Create functions.php file
-
Go to theme directory & create a file called functions.php. Add the below codes there
<?php
if (!defined('THEME_VERSION')) {
define('THEME_VERSION', '1.0.0');
}
-
Here we define a theme version number in a variable called THEME_VERSION. The version will use later.