A custom WordPress nav walker class to fully implement the Twitter Bootstrap 4.0+ navigation style (v3-branch available for Bootstrap 3) in a custom theme using the WordPress built in menu manager.
Is there a way to easily add classes to elements of the dropdown submenus, in order to correctly style them and their child elements?
Right now, they always get the default styles, which is a white background whit blue highlight.
Is it possible to somehow pass list of classes to add to the relevant elements when the WP_Bootstrap_Navwalker() is instantiated? This would make it easier to always keep the relevant styling, because by directly modifying wp-bootstrap-navwalker.php all customizations would be lost when updating to new released versions.
As an example, with a simple dropdown with just one sublevel, I think that the elements that should be able to receive list of classes should be:
ul.dropdown-menu > li.nav-item > a.dropdown-item.
I don't know what could be the best way to accomplish this, but like I said, a suggestion could be to have variables containing list of classes passed down when instantiating the class, in a similar way of the Wordpress core function wp_nav_menu()
Is there a way to easily add classes to elements of the dropdown submenus, in order to correctly style them and their child elements?
Right now, they always get the default styles, which is a white background whit blue highlight.
Is it possible to somehow pass list of classes to add to the relevant elements when the
WP_Bootstrap_Navwalker()
is instantiated? This would make it easier to always keep the relevant styling, because by directly modifyingwp-bootstrap-navwalker.php
all customizations would be lost when updating to new released versions.As an example, with a simple dropdown with just one sublevel, I think that the elements that should be able to receive list of classes should be:
ul.dropdown-menu
>li.nav-item
>a.dropdown-item
.I don't know what could be the best way to accomplish this, but like I said, a suggestion could be to have variables containing list of classes passed down when instantiating the class, in a similar way of the Wordpress core function
wp_nav_menu()