menus - Nav_walker add id to dropdown ul

I'm trying to add an id to the dropdown ul in bootstrap navwalker. So at the moment this is what I've got: <

I'm trying to add an id to the dropdown ul in bootstrap navwalker. So at the moment this is what I've got:

        <ul id="menu-primary-menu" class="list-unstyled components">
            <li id="menu-item-8" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-8 dropdown">
                <a title="Collapse 1" href="#8" data-toggle="collapse" aria-expanded="false">Collapse 1</a>
                <ul role="menu" class="collapse list-unstyled">
                    <li id="menu-item-6" class="menu-item menu-item-type-post_type menu-item-object-post menu-item-6"><a title="Collapse 1 menu item" href="">Collapse 1 menu item</a>
                    </li>
                </ul>
            </li>
        </ul>

And this is what I want

        <ul id="menu-primary-menu" class="list-unstyled components">
            <li id="menu-item-8" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-8 dropdown">
                <a title="Collapse 1" href="#8" data-toggle="collapse" aria-expanded="false">Collapse 1</a>
                <ul role="menu" class="collapse list-unstyled" id="8">
                    <li id="menu-item-6" class="menu-item menu-item-type-post_type menu-item-object-post menu-item-6"><a title="Collapse 1 menu item" href="">Collapse 1 menu item</a>
                    </li>
                </ul>
            </li>
        </ul>

Add id in here:

<ul role="menu" class="collapse list-unstyled" id="8">

So in I need to add the id which would be the same as the parent menu-item. I'm assuming I need to edit this line in bootstrap navwalker:

//default
        $output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\">\n";

//my edit
        $output .= "\n$indent<ul role=\"menu\" class=\"collapse list-unstyled\" id=\"".??."\">\n";

But I have no idea where I can get this ID from...

Thank you in advance for your help :)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745335259a4623071.html

相关推荐

  • menus - Nav_walker add id to dropdown ul

    I'm trying to add an id to the dropdown ul in bootstrap navwalker. So at the moment this is what I've got: <

    7小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信