wordpressnavbarsubmenuwp-nav-walker

Wordpress nav walker submenu Keep dropdown open when parent page selected


I am working on Wordpress Bootstrap 4 theme
i want to submenu like this like this submenu stay open
http://www.optus.com.au/
Keep dropdown open when parent page selected Anyone help me in this.

my navbar code

<div class="collapse navbar-collapse" id="navbarNavDropdown">
                    <ul id="menu-main-menu" class="nav navbar-nav><li  id=" menu-item-15"=""><a href="http://localhost/ajc-finance/" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Home</a><ul class="mega-dropdown-menu dropdown-menu depth_0">
<li id="menu-item-142" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-10 current_page_item active nav-item nav-item-142"><a class="dropdown-item" href="http://localhost/ajc-finance/lenders/">Lenders</a></li>
<li id="menu-item-143" class="menu-item menu-item-type-post_type menu-item-object-page nav-item nav-item-143"><a class="dropdown-item" href="http://localhost/ajc-finance/sample-page/">Sample Page</a></li>
<li id="menu-item-144" class="menu-item menu-item-type-post_type menu-item-object-page nav-item nav-item-144"><a class="dropdown-item" href="http://localhost/ajc-finance/sample-page/">Sample Page</a></li><li id="menu-item-145" class="menu-item menu-item-type-post_type menu-item-object-page nav-item nav-item-145"><a class="dropdown-item" href="http://localhost/ajc-finance/services/">Services</a></li></ul><li id="menu-item-14" class="menu-item menu-item-type-post_type menu-item-object-page nav-item nav-item-14"><a href="http://localhost/ajc-finance/about-us/" class="nav-link">About Us</a></li><li id="menu-item-13" class="menu-item menu-item-type-post_type menu-item-object-page nav-item nav-item-13"><a href="http://localhost/ajc-finance/services/" class="nav-link">Services</a></li>


Solution

  • The default Wordpress theme does come with submenu functionalities, you just need to style it in the way like you show in you example.

    You can also use 3rd party plugin like https://wordpress.org/plugins/megamenu/