Wordpress nav walker子菜单选择父页面时保持下拉列表打开

时间:2017-10-10 07:22:45

标签: wordpress navbar submenu wp-nav-walker

我正在研究Wordpress Bootstrap 4主题
我希望像like this submenu stay open这样的子菜单 http://www.optus.com.au/
选择父页面时,保持下拉列表打开 任何人都可以帮助我。

我的导航栏代码

<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>

1 个答案:

答案 0 :(得分:0)

默认的Wordpress主题确实带有子菜单功能,您只需要像您在示例中所示的那样设置样式。

您还可以使用第三方插件,例如https://wordpress.org/plugins/megamenu/