AlexWebLab / bootstrap-5-wordpress-navbar-walker

Bootstrap 5 WordPress navbar walker menu.
https://github.com/AlexWebLab/bootstrap-5-wordpress-navbar-walker
MIT License
250 stars 107 forks source link

How can I add extra classes for dropdown? #1

Closed ghost closed 3 years ago

ghost commented 3 years ago

I need to add a class to make a dropdown menu become right aligned, as per the Bootstrap instructions: https://getbootstrap.com/docs/5.0/components/dropdowns/#menu-alignment

The only way I can set this in Wordpress, is to add a class of 'dropdown-menu-end' to the parent menu item. This needs to be passed through to the dropdown though, but it's not.

How would this be possible to set the alignment of the dropdown menu (aside from CSS hacks)?

AlexWebLab commented 3 years ago

I just released a new version that adds support for dropdown menu (responsive) alignment: https://github.com/AlexWebLab/bootstrap-5-wordpress-navbar-walker/releases/tag/v1.3.0

Here is how it works: if one (or more) class(es) related to dropdown responsive alignment (for instance: dropdown-menu-sm-end) are detected inside the class list of the parent element, then they are copied into the class list of the .dropdown-menu element.