我尝试动态添加一个菜单,css ul/li链接的结构如下所示
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link tm-nav-link" href="#infinite">Home</a>
</li>
<li class="nav-item">
<a class="nav-link tm-nav-link" href="#whatwedo">What We Do</a>
</li>
<li class="nav-item">
<a class="nav-link tm-nav-link" href="#testimonials">Testimonials</a>
</li>
<li class="nav-item">
<a class="nav-link tm-nav-link" href="#gallery">Gallery</a>
</li>
<li class="nav-item">
<a class="nav-link tm-nav-link" href="#contact">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
我试着注册
<?php
wp_nav_menu(array(
"theme_location" => "",
\'menu_class\'=> \'navbar-nav ml-auto\'
\'container_class\' => \'navbar navbar-expand-md tm-navbar\')); ?>
但只知道如何将类添加到
<ul>
但不是所有人
<li>
因为我的导航菜单看起来很丑,所以这会造成很大的问题。