How to Easily Transfers a Bootstrap Menu in WordPress Theme Part 2

Starting from visitor’s comment that asked about the wp_bootstrap_navwalker.php does not support with the latest jquery version, I will share new tutorial how to create a bootstrap menu on WordPress theme without navwalker library. For the last article please read how to create WordPress theme with bootstrap and underscores step by step. Okay, let’s begin the tutorial, hope fixes your problem

NOTE : After a few trials, this method resulted in a dropdown menu can’t work properly 🙁 . I suggest you keep using nav_walker_library pada tutorial Create WordPress Theme with Bootstrap And Underscores Step by Step.

I assume you have read my article about how to create a WordPress theme, if not please use this link. Because I am not going to discuss it in detail for making WordPress theme, but simply an alternative way to make navbar menu bootstrap on WordPress menu without using the wp_bootstrap_navwalker.php library.

Step by step transfers bootstrap menu in WordPress theme

  1. Edit header.php and copy the navbar bootstrap menu code below

    <!-- navbar -->
    <div class="navbar-wrapper">
    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container">
    <div class="navbar-header">
    	<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
    		<span class="sr-only">Toggle Navigation</span>
    	        <span class="icon-bar"></span>
    		<span class="icon-bar"></span>
    		<span class="icon-bar"></span>
    	<a class="navbar-brand" href="<?php echo esc_url( home_url( '/' ) ); ?>" title='<?php echo esc_attr( get_bloginfo( 'description', 'display' ) ); ?>' rel='home' >
            	<img src="<?php bloginfo('stylesheet_directory'); ?>/assets/img/logosmall.png" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
    <!-- navbar-header -->
    	<?php wp_nav_menu( array( 'theme_location' => 'primary',
    		'container'	=>'nav',
    		'container_class' => 'navbar-collapse collapse',
    		'menu_class' => 'nav navbar-nav navbar-right'
    		) );
    <!-- container -->
    <!-- navbar -->
    <!-- navbar-wrapper -->
  2. Register new menu at function.php and copy the following code below

    // This theme uses wp_nav_menu() in one location.
    	register_nav_menus( array(
    		'primary' => esc_html__( 'Primary', 'azoncastv2' ),
    	) );
  3. Open footer.php and copy the following code below

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
    <script src=""></script>
  4. Create new WordPress menu and set theme location at “Primary”. Save the menu!.

    How To Easily Implement A Bootstrap Menu In WordPress Theme Part 2

  5. Please see the results in your browser

    Result Transfer Bootstrap Navbar Menu In WordPress Theme

    Responsive Navbar Menu Bootstrap Transfer To WordPress Menu

For the complete Sourcecode please download at the following links

source code Bootstrap Menu in WordPress Theme

I am so waiting for your suggestions about this article, hopefully can be a new lesson for me. Please comment in the form below.So the tutorial how to easily transfers bootstrap navbar menu to wordpress theme, hope useful

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.


 Add your comment
  1. Thank You, Sigit Prasetya for helping us by showing step by step tutorial with coding. This is very informative and important for the developers.

  2. Hi, your code helped me greatly. However I also stumbled onto a fix for your problem.

    I think you missed out a div.

    Here is the amended code, my navbar has a working dropdown and responsive button which drops down now.

    Let me know if this works, I don;t think I missed anything out.

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.