我是WordPress的新手,所以如果我重复这个问题,我很抱歉。我有HTML/CSS中的主题,我想将主题移动到WordPress,我的菜单有问题。下面我展示我的问题。我有HTML菜单:
在WordPress中,我的菜单是:
HTML是:
<nav class="navbar-default sidebar pb-30">
<ul class="nav navbar-nav nav navbar-nav side-nav text-center">
<li >
<a href="#">Home</a>
</li>
<li >
<a href="#">About Us</a>
</li>
<li>
<a aria-expanded="true" class="collapsed" href="javascript:;" data-toggle="collapse" data-target="#colapse-item-1">Gallery
<i class="ti-minus"></i>
<i class="ti-plus"></i>
</a>
<ul style="" aria-expanded="true" id="colapse-item-1" class="collapseItem collapse">
<li>
<a href="#">
<i aria-hidden="true"></i>Gallery - 1
</a>
</li>
<li>
<a href="#">
<i aria-hidden="true"></i>Gallery - 2
</a>
</li>
<li>
<a href="#">
<i aria-hidden="true"></i>Gallery - 3
</a>
</li>
<li>
<a href="#">
<i aria-hidden="true"></i>Gallery - 4
</a>
</li>
<li>
<a href="#">
<i aria-hidden="true"></i>Gallery - 5
</a>
</li>
<li>
<a href="#">
<i aria-hidden="true"></i>Gallery - 6
</a>
</li>
</ul>
</li>
<li class="active"><a href="#">Contact</a></li>
此时,我使用以下方式显示菜单:
<?php
$defaults = array (
\'theme_location\' => \'menu\',
\'container\' => \'nav\',
\'menu_class\' => \'nav navbar-nav nav navbar-nav side-nav text-center\'
);
wp_nav_menu( $defaults );
?>
但我不知道如何正确地显示/隐藏子菜单,如何检查链接是子项,如何显示父项链接。如何添加
<ul style="" aria-expanded="true" id="colapse-item-1" class="collapseItem collapse">
在我菜单的第二个ul中。