How to restore the Bootstrap nav [walkthrough]

Very helpful! Thank you @smutek

@smutek How did you get the dropdowns to work? Thanks for the vid!

Hey, no problem!

I had Soil installed and activated, aside from that I did nothing additional, outside of what you see in the video.

1 Like

This video is great. Thanks for making it. Actually your little error kept me on my toes by thinking why it was wrong. Good stuff that you debugged it in real time!

After reading on forums so much was a nice change to hear a real human talking through their dev environment!

1 Like

Just my two cents, I was reading before about all the stick* Ben was getting after making the changes to the Bootstrap menu. The Bootstrap menu works great for a quick small site like Iā€™m doing now, but for any site with a proper budget and a designer involved, it just gets in the way.

Iā€™ve spent countless hours just fighting against the Bootstrap menu because no designer will ever make a design like this!

Great work again guys

*British English - hopefully doesnā€™t mean anything very offensive otherside of the pond!

hi,
thank you for this video!

it was very useful to restore the navwalker menuā€¦but the soil clean urls doesnā€™t work for me.

thereā€™s a solution for multilevel drop down menu too?

thanks

Glad Iā€™m not the only one having this issue.

Iā€™ve had no problem restoring the bootstrap walker. First-level dropdowns work fine.
However my second-level dropdowns arenā€™t really working.

If a user clicks on a navigation within a dropdown which is itself a parent for second-level dropdown, then the second level menu will not show as expected.

Bootstrap removed sub-menu support in version 3. Youā€™ll need to edit the walker and add your own CSS to support it.

1 Like

Thank you , saved me a bit of time

Hi everyone! Must say many thanks to @smutek for the nice video. Now I got the bootstrap menu working but unfortently now the soil-nav-walker isnā€™t working. It did before I added the bootstrap nav. Is there anyone else who got problem with this ?

They are two different nav walkers. By using the Bootstrap nav walker, the Soil one isnā€™t applied anymore.

Thank you so much! Very well done and easy to follow.

1 Like

Hi there!

If you need to manipulate the output of the WordPress navigation other than the normal Bootstrap Walker, iā€™ve created a function for that. You can define all the required classes based on the level of the menu with or without submenu. Maybe it could help someone.

3 Likes

Hello, may I know how can I restore the parent url rather than replacing them to ā€œ#ā€? Is it possible for the submenu be shown during hover state and not just when clicking the parent menu? I would like to know how can I do it as I also want to be able to click and load the parent menu page rather than just clicking them just to show the submenu. I hope you guys understand what I am trying to sayā€¦

Thank you in advance,
Randy

Hey Randy, those questions pertain more to Bootstrap than they do to Sage. If you google something like ā€˜bootstrap hover openā€™ I think youā€™ll find itā€™s been covered a lot.

Good luck!

I donā€™t think so, because when I check the the wp_bootstrap_navwalker.php file it seems it must be changed the actual parent url to ā€œ#ā€ always, somewhere on line 85 https://goo.gl/jhhOk1.

I hope we could have the chance to choose whether we want to replace the parent url or not, which will make it on hover state anytime we want. I donā€™t know if this is possible using your nav walker with bootstrap.

Hi,

I am new to Roots/Sage project. What a wonderful project with my fav tools for dev.

Thank you so much for making this short video and helping me get started with the NAV menu, as I was thinking Sage had all Bootstrap stuff but after some googling and your helpful post and video I am able to fix only issue I faced on first try of Sage i.e. the nav markup.

For people who may have not luxury to watch video due to workplace or anything. Here are steps performed by Jimmy Smutek in the video for quick overview:

Three Easy Steps :

1. Download Php file and place it in ā€œlibā€ folder inside your theme directory.
a. Download from this github repo https://github.com/twittem/wp-bootstrap-navwalker
b. Php File you need to download and copy to lib folder is wp_bootstrap_navwalker.php

2. Link Walker Php Class File from your ā€œfunctions.phpā€ file: Open your functions.php file, and link this newly copied file there in $sage_includes array, where you see e.g lib/assets.php already included. You just include another line e.g. lib/wp_bootstrap_navwalker.php

3. Add HTML Markup in Header.php file from following gist: Open this gist https://gist.github.com/retlehs/1b49f6c00d5140962d56 and copy all the HTML markup, to your header.php file, replacing the existing header markup there.


That is it! You will have working Bootstrap based menu with dropdown support. Thanks to Sage developers for awesome starter theme and thanks to Jimmy for making my first day with Sage/Roots awesome with his short video guide!

4 Likes

Glad youā€™ve found it helpful! Iā€™ve been meaning to update that video. Hereā€™s another approach thatā€™s even easier -

Install and activate the Sagextras plugin by Michael Romero - https://github.com/storm2k/sagextras

Add add_theme_support('se-nav-walker'); to your functions, I usually drop this in the top of lib/setup.php, right below the Soil stuff.

Replace the contents of header.php with the contents of this gist - https://gist.github.com/johnny-bit/cc8840f148da01c2af52

Thatā€™s it!

3 Likes

Thank you for showing alternative approach it may help even more users!

By the way I find non-plugin solution better so I can easily package the theme and deliver to client with no extra plugin dependencies.

Loving the awesome work which has been done in this project! Thanks to all contributing developers!

1 Like

Not sure if this has been covered, but since Bootstrap 4 has been included in Sage by default, there is a new wp_bootstrap_navwalker.php file that can be used:

Took me a while to find it, as the original file still appears to only support up to Bootstrap 3.

11 Likes