WordPress functions.php template file – functions.php WordPress Custom Template

WordPress functions.php template file – functions.php WordPress Custom Template

What is the functions.php template file for WordPress Template Hierarchy of files?

The functions.php file in custom WordPress template behaves like a WordPress Plugin, adding features and functionality to a WordPress site through PHP code when your template is activated in the WordPress admin dashboard. You can use it to call native PHP functions, WordPress functions, or to define your own functions.


  1. Function Snippet – register_nav_menus()

Add the snippet below in your functions.php template file to register 3 navigation Menus for your blank #WordPress template


// Blank WordPress Template Register 3 Navigation Menus for Blank WordPress Template
// Register Top Menu
// Register Header Menu
// Register Footer Menu
if ( ! function_exists( ‘bwt_register_nav_menu’ ) ) {

function mytheme_register_nav_menu(){
register_nav_menus( array(
‘top_menu’ => __( ‘Primary Menu’, ‘bwt’ ),
‘header_menu’ => __( ‘Header Menu’, ‘bwt’ ),
‘footer_menu’ => __( ‘Footer Menu’, ‘bwt’ ),
) );
}
add_action( ‘after_setup_theme’, ‘bwt_register_nav_menu’, 0 );
}


blockquote