我如何在wp_nav_menus中使用li和一个类()

我如何在wp_nav_menus中使用< li> 和< a> 类?

< div class="collapse navbar-collapse" id="ftco-nav"> < ul class="navbar-nav nav ml-auto"> < li class="nav-item"> < a href="http://www.srcmini.com/#home-section" class="nav-link"> < span> Home< /span> < /a> < /li> < li class="nav-item"> < a href="http://www.srcmini.com/#about-section" class="nav-link"> < span> About< /span> < /a> < /li> < li class="nav-item"> < a href="http://www.srcmini.com/#skills-section" class="nav-link"> < span> Skills< /span> < /a> < /li> < li class="nav-item"> < a href="http://www.srcmini.com/#projects-section" class="nav-link"> < span> Projects< /span> < /a> < /li> < li class="nav-item"> < a href="http://www.srcmini.com/#blog-section" class="nav-link"> < span> My Blog< /span> < /a> < /li> < li class="nav-item"> < a href="http://www.srcmini.com/#contact-section" class="nav-link"> < span> Contact< /span> < /a> < /li> < /ul> < /div>

#1
< ul class="list-unstyled nav1 cl-effect-10"> < li class="Home"> < adata-hover="Home" class="active"> < span> Home< /span> < /a> < /li> < li class="About"> < a data-hover="About"href="http://www.srcmini.com/about.html"> < span> About< /span> < /a> < /li> < li class="Rooms"> < a data-hover="Rooms"href="http://www.srcmini.com/rooms.html"> < span> Rooms< /span> < /a> < /li> < li class="Gallery"> < a data-hover="Gallery"href="http://www.srcmini.com/gallery.html"> < span> Gallery< /span> < /a> < /li> < li class="Dinning"> < a data-hover="Dinning" href="http://www.srcmini.com/dinning.html"> < span> Dinning< /span> < /a> < /li> < li class="News"> < a data-hover="News" href="http://www.srcmini.com/news.html"> < span> News< /span> < /a> < /li> < li> < a data-hover="Contact Us" href="http://www.srcmini.com/contact.html"> < span> contact Us< /span> < /a> < /li> < /ul> < /div>

【我如何在wp_nav_menus中使用li和一个类()】请尝试以下代码:
< ?php $location=get_nav_menu_locations(); $menuid =$location['header']; $primarymenu = wp_get_nav_menu_items($menuid); ?> < ul class="list-unstyled nav1 cl-effect-10 "> < ?php foreach($primarymenu as $key=> $value) { ?> < li class="< ?php echo $value-> title; ?> "> < a data-hover="< ?php echo $value-> title; ?> "href="http://www.srcmini.com/< ?php echo $value-> url; ?>"> < span> < ?php echo $value-> title; ?> < /span> < /a> < /li> < ?php } ?> < /ul> < /div>

    推荐阅读