Menu with subitems
I have menu with subitems, like this:
– where every item (MenuItem and SubItems) must be a link.
By default MenuItem has ‘a’ tag with “#” in href parameter.
I made some changes in ../inc/wp_bootstrap_navwalker.php:
// If item has_children add atts to a. if ( $args->has_children && $depth === 0 ) $atts['href'] = $item->url;
(changed from ‘#’; to $item->url;)
– after that MenuItem becomes link, but don’t work.
If i comment two lines in this section:
$atts['href'] = $item->url; // $atts['data-toggle'] = 'dropdown'; // $atts['class'] = 'dropdown-toggle'; $atts['aria-haspopup'] = 'true';
– then main MenuItem works, but i can’t use submenu items via popup.
Is it possible to make then: first click on MenuItem will open submenu popup, second click on MenuItem will open MenuItem-link?
Yes unfortunately with this menu script if you use one method you can use the other.
This menu is made for mobile devices. On a mobile device if you click on a parent menu it should dropdown the child items. Otherwise you wouldn’t be able to access then.
What I recommend you do is switch it out for another menu.
You can use ShiftNav – Responsive Menu Plugin.
And switch it out in the header.php file.
Hope that helps.
Thanx, than maybe it’s possible to expand popup SubMenu on focus?
Yes ShiftNav uses an elegant shift-out navigation.
It displays the parent and child menu items at the same time.
Once you enable it you will see how it works.
Hans, thanks for the advice, i tried ShiftNav…but this decision is even worse that it was by default: ShiftNav doesn’t work correctly with my multilanguage plugin integrated in menu (Stella plugin) and doesn’t work in mobile browser (empty menu in Opera Mobile).
You must be logged in to reply to this topic.