我如何在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>
推荐阅读
- 如何在WordPress的Kalium主题上将logo居中()
- linux之tree命令
- 性能环境之docker操作指南4(全网最全)
- 2021年热门的IT平台及热门课程精选
- 免费教程STM32MP157开发教程之FreeRTOS系统篇3(FreeRTOS 计数型信号量)
- 视频流异步转码和实时流式转码是什么意思(有什么区别?)
- 鸿蒙分包与Android app组件化
- 太震撼了!我把七大JS排序算法做成了可视化!!!太好玩了!
- 重新学习C语言day06