Wordpress自定义自定义菜单类

php
阅读 47 收藏 0 点赞 0 评论 0

wp-custom-menu-class.php
Instructions:

You must use the 'menu' argument along with the slug you assigned to the custom menu in functions.php
and NOT the 'theme-location' arg, or it will not work!!

<?php 
  
  wp_nav_menu(array( 
                'container_class' => 'navbar-collapse collapse', 
                'items_wrap' => '<ul class="nav navbar-nav">%3$s</ul>', 
                'menu'  => 'primary-menu', 
            ) ); 
?>

On one line:

<?php wp_nav_menu(array( 'container_class' => 'navbar-collapse collapse', 'items_wrap' => '<ul class="nav navbar-nav">%3$s</ul>', 'menu'  => 'primary-menu') ); ?>


Output:

<div class="navbar-collapse collapse">
  <ul class="nav navbar-nav">
    <li ... ></li>
  </ul>
</div>
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号