<nav>
<ul class="navigation" >
<li class="normal" >
<a href="">
<span class="label-nav">
</span>
<span class="label-nav-sub" data-hover="">
</span>
</a>
<ul>
<li>
<a href="">
</a>
</li>
<li>
<a href="">
about us
</a>
</li>
<li>
<a href="">
location
</a>
</li>
<li>
<a href="">
contact
</a>
</li>
</ul>
我试过这个代码,但没用我是WordPress新手
最合适的回答,由SO网友:Jahirul Islam Mamun 整理而成
<?php
wp_nav_menu(array(
\'theme_location\' => \'menu_location\',
\'container\' => false,
\'items_wrap\' => \'%3$s\',
\'items_wrap\' => \'<ul id="nav-primary" class="navigation %2$s"><li class="normal"><a href=""><span class="label-nav"></span><spanvclass="label-nav-sub" data-hover=""></span></a> %3$s</ul>\',
));
?>
在上面的示例中,您也可以使用静态项。
要使其动态化,您可以使用nav walker查看此示例-https://developer.wordpress.org/reference/functions/wp_nav_menu/#comment-content-207