如何在wordpress上使这个菜单动态化?

时间:2015-12-15 18:33:58

标签: php html css wordpress menu

我有一个静态的html,css菜单,但现在我想用wordpress使其动态化。所以我可以从wordpress外观 - >菜单部分设置菜单 如果有人可以帮助我会很棒

以下是代码:

<nav>
  <div id='cssmenu'>

    <ul>

       <li><a href='/'><span>Home<br>
          <small class="nosmall">Go Home</small>
       </span></a></li>

       <li><a href='about'><span>About<br>
          <small>Our Overview</small>
       </span></a>      
       </li>



       <li><a href='team/'><span>Our Team<br>
           <small>Meet Us</small>
       </span></a></li>

       <li><a href='contact/'><span>Contact<br>
          <small>Let's Work Together</small>
       </span></a></li>

        <li><a href='articles-publications/'><span>Articles & Publications<br>
          <small>Legal Resources</small>
        </span></a>               
       </li>
    </ul>

</div>
</nav>

1 个答案:

答案 0 :(得分:0)

您可以在wordpress中使用wp nav菜单进行动态菜单。

https://codex.wordpress.org/Function_Reference/wp_nav_menu

$defaults = array(
    'theme_location'  => '',
    'menu'            => '',
    'container'       => 'div',
    'container_class' => '',
    'container_id'    => '',
    'menu_class'      => 'menu',
    'menu_id'         => '',
    'echo'            => true,
    'fallback_cb'     => 'wp_page_menu',
    'before'          => '',
    'after'           => '',
    'link_before'     => '',
    'link_after'      => '',
    'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
    'depth'           => 0,
    'walker'          => ''
);

wp_nav_menu( $defaults );