WordPress Functions
In theme design create a functions.php file inside the theme folder.
functions.php – This file will contain the code of built in wordpress function and user defined function.
Example – Adding Custom menu in your theme
At First Register menus in functions.php file –
if ( function_exists( 'register_nav_menus' ) ) { register_nav_menus( array( 'foot_menu' => 'My Custom Footer Menu', 'sidebar_menu' => 'Super Sidebar Menu' ) ); }he above code defines if you have more than one menu. If you want just one menu delete the second one.
In second step login to dashboard and create menu as follows –
Now Attach custom menu to your “declared” menu
Finally Insert the menu into the theme-
Now anywhere in your theme you want to display that menu, use :
<?php wp_nav_menu( array('menu' => 'Footer Menu' )); ?> <?php wp_nav_menu( array( 'theme_location' => 'Footer Menu' ) ); ?>