Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 4 navwalker - multilevel menu

I'm using this nav walker in my Wordpress project. I want to create multilevel menu, for example. What I need to change to get it work? Or maybe is it another walker for BS4 with multilevel menu support?

Menu Item
- Sub menu
-- Sub menu item
-- Sub menu item
Menu Item
like image 925
MMPL1 Avatar asked Jul 18 '18 09:07

MMPL1


1 Answers

  1. Add this css

    ul.dropdown-menu li > ul.dropdown-menu{
        left: 100%;
        top: 0;
    }
    
    ul.dropdown-menu li:hover > ul.dropdown-menu, ul.dropdown-menu li:focus > ul.dropdown-menu{
        display: block
    }
    
  2. Remove this code && 0 === $depth from class-wp-bootstrap-navwalker.php

    original code:

    if ( isset( $args->has_children ) && $args->has_children && 0 === $depth && $args->depth > 1 ) {
    

    After editing:

    if ( isset( $args->has_children ) && $args->has_children && $args->depth > 1 ) {
    
like image 56
MD. Shafayatul Haque Avatar answered Nov 14 '22 01:11

MD. Shafayatul Haque