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

Dropdown ul has inline style css #29

Closed bosquedesigns closed 1 year ago

bosquedesigns commented 1 year ago

I'm new to wp walkers, and I'm not sure if this is an issue with this code, but I thought I'd ask. I'm working on completing a custom WordPress theme built on BS-5 that I was handed but it didn't have dropdown support for WP menus. That's where I found your code to add to my sidebar. I copied your function code directly into my functions.php and below is in my sidebar.php file. <?php wp_nav_menu(array( 'theme_location' => 'left-column-menu', 'container' => false, 'menu_class' => '', 'fallback_cb' => '__return_false', 'items_wrap' => '<ul id="%1$s" class="navbar-nav me-auto mb-2 mb-md-0 %2$s">%3$s</ul>', 'depth' => 2, 'walker' => new bootstrap_5_wp_nav_menu_walker() )); ?>

The code works and creates dropdowns, however, when I click the dropdown, I see an inline style tag and javascript "data-popper-placement" tag that displays within the 2nd level ul tag like this <ul class="dropdown-menu depth_0 show" style="position: absolute; inset: 0px auto auto 0px; margin: 0px; transform: translate(0px, 48px);" data-popper-placement="bottom-start">

I can't find where this code is coming from that inserts this inline style CSS but I need to remove it because it displays poorly on the page. Could you point me in the direction to remove this style?

Any help would be much appreciated.

bosquedesigns commented 1 year ago

After doing some more research, it turns out that this is a native bootstrap process for dropdown menus. For a sidebar menu I need to use an accordion style menu, If you have a walker that works with bootstrap accordions, I would love to take a look at it.

Thanks!

AlexWebLab commented 1 year ago

I'm glad you figured it out by yourself. At the moment I have no plan to build a walker for accordions. Thank you.