如何在ul容器wp_nav_menu wordpress和其他html标签之后添加另一个li容器?

时间:2015-03-03 04:05:26

标签: php html wordpress menu menubar

  

请帮助我用walker帮助我wp_nav_menu,谢谢

              <ul class="nav navbar-nav">
        <li class="dropdown yamm-fw"><a href="#" data-toggle="dropdown" class="dropdown-toggle">PROJECT<b class="caret"></b></a>
              <ul class="dropdown-menu">
            <li class="grid-demo">
                  <div class="row">
                <div class="col-sm-5">
                      <div class="col-sm-4"><a href="#" class="linkTrang">Introduction</a></div>
                      <div class="col-sm-4"><a href="#" class="linkTrang">Floor Plans A Type</a></div>
                      <div class="col-sm-4"><a href="#" class="linkTrang">Floor Plans B Type</a></div>
                      <div class="col-sm-4"><a href="#" class="linkTrang">Floor Plans C Type</a></div>
                      <div class="col-sm-4"><a href="#" class="linkTrang">Floor Plans D Type</a></div>
                      <div class="col-sm-4"><a href="#" class="linkTrang">Floor Plans E Type</a></div>
                    </div>
              </div>
                </li>
          </ul>
            </li>
  

如何在<li class="grid-demo"> <div class="row"> <div class="col-sm-5">

等ul标签后添加一些容器标签
        <li><a href="#">LOCATION</a></li>
        <li><a href="#">FEATURES</a></li>
        <li class="dropdown yamm-fw"><a href="#" data-toggle="dropdown" class="dropdown-toggle">PAYMENT<b class="caret"></b></a>
              <ul class="dropdown-menu">
            <li class="grid-demo">
                  <div class="row">
                <div class="col-sm-5">
                      <div class="col-sm-4"><a href="#" class="linkTrang">Playment T&C</a></div>
                      <div class="col-sm-4"><a href="#" class="linkTrang">Financial Services</a></div>
                    </div>
              </div>
                </li>
          </ul>
            </li>
            <div class="spanLogo">aaa</div>
  

如何在此处添加一个<div class="spanLogo">aaa</div>

     

继续

            <li class="dropdown yamm-fw"><a href="#" data-toggle="dropdown" class="dropdown-toggle">PUBLICITY<b class="caret"></b></a>
              <ul class="dropdown-menu">
            <li class="grid-demo">
                  <div class="row">
                <div class="col-sm-5">
                      <div class="col-sm-4"><a href="#" class="linkTrang">News & Events</a></div>
                      <div class="col-sm-4"><a href="#" class="linkTrang">Testimonial</a></div>
                    </div>
              </div>
                </li>
          </ul>
            </li>
  

在这里&gt; &GT;以及如何添加一个像上面的代码一样的标签,谢谢

        <li><a href="#">CONTACT</a></li>
         <a class="navbar-brand" href="#"><img src="images/logo_paujar_top.jpg"/></a>
      </ul>

1 个答案:

答案 0 :(得分:1)

我想建议你应该使用wp_get_nav_menu_items()函数。在此功能中,您可以单独获取所有菜单标题和网址,轻松管理您的HTML。

这是演示

<?php $menu_item = wp_get_nav_menu_items($menuId); foreach($menu_item as $menu):?> <a class="menu-iterm" href="<?php echo $menu->url;?>"> <?php echo $menu->title;?> </a> <?php endforeach;?>

有关详细信息,请访问http://codex.wordpress.org/Function_Reference/wp_get_nav_menu_items