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.

Home Page:https://wp-bootstrap.github.io/wp-bootstrap-navwalker/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dropdown menu is missing the dropdown-toggle class.

adampatterson opened this issue · comments

Steps to reproduce the issue:

A parent menu item that is a page with a few sub-pages.

What I expected:

I'd like to see the dropdown toggle.

The dark menu is hardcoded, while the light menu was generated with WP_Bootstrap_Navwalker

image

What happened instead:

The generated HTML functions as a dropdown menu but the parent menu item is missing dropdown-toggle.

I followed the code and can see that the $atts['class'] = 'dropdown-toggle nav-link'; I can also see that the HTML in side of $item_output contains the proper classes.

If I place the dropdown class in the WordPress menu on that item the icon shows under the link.

image

My Walker code

wp_nav_menu(array(
    'menu'           => 'main-menu',
    'theme_location' => 'main-menu',
    'menu_id'        => 'navigation',
    'depth'          => 3,
    'container'      => false,
    'escape_titles'  => false,
    'menu_class'     => 'navbar-nav mr-auto',
    'walker'         => new WP_Bootstrap_Navwalker()
));

I can't reproduce this with the current master branch. Which version of the walker are you using? There was a bug preventing the caret to show up (see #435) which was fixed in #481.

I was logging this at work, but I no longer work there.

But I do still use this package so let me double-check!

@IanDelMar I still don't have the carrots.

Over the next few days, I will see if I can track it down.

I know that if you follow the execution you do have the proper CSS but at some point, it gets removed.

@adampatterson Any news on this issue?

Closing this as the mentioned behavior is still not reproducible. Please re-adress the issue if it comes up again.

@IanDelMar Hey, Sorry for the long delay.

After much digging, I came across the culprit, there was a filter nav_menu_css_class that set the LI links to nav-item removing the data-toggle!

@adampatterson Thanks for the feedback!