如何使用wp菜单创建这种菜单?

时间:2018-06-18 09:57:37

标签: php wordpress wp-nav-walker wp-nav-menu-item

我想使用wp_nav_menu创建以下代码。如何使用wp_nav_menu创建此代码?还有如何使用wp_nav_menu将UL课程页面更改为页面?

<div class="collapse navbar-collapse" id="navbarNavDropdown">
    <ul class="navbar-nav hatch-main-nav-inner hatch-main-nav-inner--red">
        <li class="nav-item">
            <a class="nav-link" href="<?php bloginfo('url'); ?>/about">About</a>
        </li>
        <li class="nav-item active">
            <a class="nav-link" href="<?php bloginfo('url'); ?>/co-working">Co-working <span class="sr-only">(current)</span></a>
            <div class="hatch-secondary-menu">
                <a class="hatch-secondary-menu-item hatch-secondary-menu-item--active" href="<?php bloginfo('url'); ?>/co-working">Overview</a>
                <a class="hatch-secondary-menu-item" href="#">Pricing</a>
                <a class="hatch-secondary-menu-item" href="#">Perks</a>
                <a class="hatch-secondary-menu-item" href="#">Locations</a>
            </div>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="<?php bloginfo('url'); ?>/start-ups">Start-ups</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="<?php bloginfo('url'); ?>/membership">Membership</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="<?php bloginfo('url'); ?>/events">Events</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="<?php bloginfo('url'); ?>/contact">Contact</a>
        </li>

    </ul>
</div>

我现在使用此代码:

<?php
wp_nav_menu( 
    array( 
        'menu_class' => 'navbar-nav hatch-main-nav-inner hatch-main-nav-inner--red', 
        'container' => false, 
        'theme_location' => 'header-menu', 
        'items_wrap' => '<ul>%3$s</ul>', 
        'depth' => 1, 

    ) 
);
?>

使用此代码我可以查看主URL,但我不知道如何查看子菜单项。

0 个答案:

没有答案