wp-bootstrap / wp-bootstrap-navwalker

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.
https://wp-bootstrap.github.io/wp-bootstrap-navwalker/
GNU General Public License v3.0
3.37k stars 1.94k forks source link

href attribute filter on parent item cancels disabled class #436

Closed nahummadrid closed 3 years ago

nahummadrid commented 5 years ago

I've enabled hovering dropdowns and when using add_filter( 'nav_menu_link_attributes', 'my_hover_dropdown_parent_link', 10, 4); to allow href links on nav items and that works fine but then the "disabled" class stops working if I do want to disable some links.

I tried adding disabled class on some parent menu items to remove the link but my filter overrides.

What I ended up doing to get it to work is switching the order here:

Line 202 // Allow filtering of the $atts array before using it. $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
// update atts of this item based on any custom linkmod classes. $atts = self::update_atts_for_linkmod_type( $atts, $linkmod_classes ); Would there have been a better way so I don't have to edit the navwalker.

IanDelMar commented 3 years ago

Is this still relevant to you?

nahummadrid commented 3 years ago

Not really no. Thanks