为主题添加多个WordPress3.0自定义菜单

为主题添加多个WordPress3.0自定义菜单 使用
  1. <?php wp_nav_menu($args); ?>

默认设置

  1. <?php $defaults = array(
  2. 'menu'            => ,
  3. 'container' => 'div',
  4. 'container_class' => ,
  5. 'container_id'    => ,
  6. 'menu_class' => 'menu',
  7. 'menu_id' => ,
  8. 'echo'            => true,
  9. 'fallback_cb'     => 'wp_page_menu',
  10. 'before'          => ,
  11. 'after' => ,
  12. 'link_before'     => ,
  13. 'link_after' => ,
  14. 'depth'           => 0,
  15. 'walker'          => ,
  16. 'theme_location' => );
  17. ?>

可选参数

$menu
( string) ( 可选) 期望显示的菜单The menu that is desired; accepts (matching in order) id, slug, name
默认:  None
$container
( string) ( 可选) 容器,可以设置为 ul 或 div。Whether to wrap the ul, and what to wrap it with
默认: div
$container_class
( string) ( 可选) 容器的 class 。the class that is applied to the container
默认: menu-{menu slug}-container
$container_id
( string) ( 可选) 容器的 id 。The ID that is applied to the container
默认:  None
$menu_class
( string) ( 可选)菜单的 ul 元素的 class。CSS class to use for the ul element which forms the menu
默认: menu
$menu_id
( string) ( 可选) 菜单 ul 元素的 id。The ID that is applied to the ul element which forms the menu
默认: menu slug, incremented
$echo
( boolean) ( 可选) Whether to echo the menu or return it
默认: true
$fallback_cb
( string) ( 可选)如果惨不存在使用的返回函数。 If the menu doesn’t exists, the callback function to use
默认: wp_page_menu
$before
( string) ( 可选) Output text before the link text
默认:  None
$after
( string) ( 可选) Output text after the link text
默认:  None
$link_before
( string) ( 可选) Output text before the link
默认:  None
$link_after
( string) ( 可选) Output text after the link
默认:  None
$depth
( integer) ( 可选) 可以设置成几级菜单,0 为无限极。 how many levels of the hierarchy are to be included where 0 means all
默认: 0
$walker
( object) ( 可选) Custom walker object to use
默认:  None
$theme_location
( string) ( 可选) 指定菜单的位置。位置必须是 register_nav_menu() 里定义的。 the location in the theme to be used–must be registered with register_nav_menu() in order to be selectable by the user
默认:  None

示例

默认

<div>
    <?php wp_nav_menu(); ?>
</div>

显示一个指定的菜单

<?php wp_nav_menu( array('menu' => 'Project Nav' )); ?>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值