The last word on Sage 9 Bootstrap 4 Navwalkers

Soil ā€œcleans upā€ the menu by using its own Walker. Since youā€™re using @MWDelaneyā€™s Walker, Soilā€™s is never used. Thatā€™s not a bug. If you feel like his plugin can be improved, Iā€™m sure heā€™d be happy to review a pull request.

1 Like

ah, thats such a shame. its so nice and clean to have clean html. It would be nice if @MWDelaney could review this and get a clean nav walker working like the soil one. Sorry no idea on how to do a pull request at moment as i dont use github (yea major downside i know I should be using it!).

Thatā€™s not a feature Iā€™m planning to add at this point.

No time like the present to learn! Git is an invaluable tool for development, and collaboration is the foundation of open software like Sage. Hereā€™s a good guide to help you learn how pull requests work: How To Create a Pull Request on GitHub | DigitalOcean

2 Likes

ah. such a shame. thank for letting me know. Perhaps it will get me to delve into it and have a go myself.

Thanks @alwaysblank yup will do. have been meaning too for ages. Just dont get the opportunity.

so i was fiddling about trying to work out how to get bootsrap nav working with soil and found this:

I actually commented on that post but must have missed it somehow. Anyways i used that custom nav walker and bootsrap nav works with clean menu links :slight_smile:

Iā€™m wondering if this is the right place to ask this, but the active class is not being added to any menu items that are linked to a custom post type. Any clue why that is?

@MWDelaney Thanks for this ā€“ Works great! What is the best way to make the parent-level menu items as active links without worrying about this being over written during an upgrade to your script? We found this: https://medium.com/@oscarmwana/make-parent-link-clickable-in-bootstrap-wordpress-navigation-walker-61213063a1a0 - But it looks like this got overwritten at some point when one of our developers cloned the project.

Thanks in advance!

Hi, @Daniel. Truly the best way to do this would be to fork the project and maintain that functionality yourself. Since top-level linking is not supported by Bootstrap, itā€™s not a priority in this project, and is likely to break (as youā€™ve found) when changes are made.

@MWDelaney Thank you sir!

@AmirFarid have you resolved?

Is there a way to use bootstrap 4 nawalkers and soil?

1 Like

Hi there,
Thank you again for this! I canā€™t seem to get this to work out of the box. I have tried the controller way and adding namespace to the top as well, but to no avail. Any help would be appreciated.

Fatal error : Uncaught Error: Class ā€˜App\Controllers\wp_bootstrap4_navwalkerā€™ not found in /www/sites/sage/wwwroot/wp-content/themes/mysage/app/Controllers/App.php:39

Thank you in advance,
Josh

The info in this thread is a little out of date. Be sure to check the documentation at the repository here:

It looks like you need to change your walker from

...
    'walker'            => new wp_bootstrap4_navwalker()
...

to

...
    'walker'            => new \App\wp_bootstrap4_navwalker()
...

Thank you!!! This worked. Apologies.

Is there a way to use bootstrap 4 nawalkers and soil?

@MWDelaney , has there been any additional thought toward this, or is there another method to do this? I would be grateful.

Iā€™ve been trying to figure this out for a week to work with Soil, but no luckā€¦ Rookie

Soilā€™s navwalker and this one are alternative tools. Theyā€™re not meant to work together and I donā€™t plan to add they as a feature at this time.

1 Like

Thank you for the reply, I really do appreciate your knowledgeā€¦

Can you recommend a way to still use Soil with the nice links, but not have a lengthy class ā€œmenu-item menu-item-type-post_type menu-item-object-page nav-item nav-item-18ā€ utilizing this method?

Any help would be greatly appreciated ā€“ I have about 30+ links total and could definitely appreciate less bloat.

Hey @boothwise - you probably need to create your own custom nav walker that combines the elements you want from each. Spending some time looking at the source of Michaelā€™s BS nav walker and the soil nav walker will help you understand how they work and should give you all the insight you need.

Does this still work with bootstrap 5?

This is how I ended up doing it : https://thewpgeek.com/add-a-responsive-menu-in-sage/ I would be interested in anything I should change in the tutorial (especially if something is not best practice)