How to Convert Bootstrap Menu to WordPress Menu
1. Register Menu from your functions.php file
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'jhilik' ),
) );
2. Add This below code to your functions.php file
/*--------------------------------------------
17. Register custom navigation walker
----------------------------------------------*/
require_once('inc/wp_bootstrap_navwalker.php');
3. Put the wp_bootstrap_navwalker.php file to your inc folder (or any place) of your theme.
You can get the wp_bootstrap_navwalker.php from here
4. Replace the header.php code
Home
About Us
Services
Portfolio
Pages
Blog Single
Pricing
404
Shortcodes
Blog
Contact
wp_nav_menu( array(
'menu' => 'primary',
'theme_location' => 'primary',
'depth' => 2,
'container' => 'div',
'container_class' => 'collapse navbar-collapse navbar-ex1-collapse',
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker())
);
?>
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'jhilik' ),
) );
2. Add This below code to your functions.php file
/*--------------------------------------------
17. Register custom navigation walker
----------------------------------------------*/
require_once('inc/wp_bootstrap_navwalker.php');
3. Put the wp_bootstrap_navwalker.php file to your inc folder (or any place) of your theme.
You can get the wp_bootstrap_navwalker.php from here
4. Replace the header.php code
Pages
by
wp_nav_menu( array(
'menu' => 'primary',
'theme_location' => 'primary',
'depth' => 2,
'container' => 'div',
'container_class' => 'collapse navbar-collapse navbar-ex1-collapse',
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker())
);
?>