wp_nav_nemu

  1. <?php
  2. /*
  3. *@type string $menu 后台导航分类的名称或id
  4. *@type string $menu_class 导航ul的类,默认值'menu'.
  5. *@type string $menu_id 导航ul元素的id
  6. *@type string $container 包括导航ul的标签默认为div
  7. *@type string $container_class 包括导航ul标签的class默认为空
  8. *@type string $container_id 包括导航ul标签的id默认为空
  9. *@type callable|bool $fallback_cb 如果菜单不存在则启用的返回函数'wp_page_menu'.
  10. *@type string $before 导航A标签之前
  11. *@type string $after 导航A标签之后
  12. *@type string $link_before 导航链接名之前
  13. *@type string $link_after 导航链接名之后
  14. *@type bool $echo 是否输入,false则为赋值
  15. *@type int $depth 调用层级,默认为0调用所有
  16. *@type object $walker 调用一个对象定义显示导航菜单
  17. *@type string $theme_location 指定显示的导航名,如果没有设置,则显示第一个
  18. *@type string $items_wrap 导航列表的包括标签默认是带有id和class的ul通过sprintf输出
  19. *
  20. */
  21. $menu_args = array(
  22. //最外层容器的标签名,默认div
  23. 'container' => 'div',
  24. //最外层容器的class名
  25. 'container_class' => 'mainNavBlock',
  26. //最外层容器的id名
  27. 'container_id' => 'menu',
  28. //导航菜单ul标签的class名
  29. 'menu_class' => 'mainNav',
  30. //导航菜单ul标签的id名
  31. 'menu_id' => 'nav',
  32. //是否打印,默认是true,如果想将导航的代码作为赋值使用,可设置为false
  33. 'echo' => true,
  34. //备用的导航菜单函数,用于没有在后台设置导航时调用
  35. 'fallback_cb' => 'the_main_nav',
  36. //显示在导航a标签之前
  37. 'before' => '',
  38. //显示在导航a标签之后
  39. 'after' => '',
  40. //显示在导航链接名之前
  41. 'link_before' => '',
  42. //显示在导航链接名之后
  43. 'link_after' => '',
  44. //显示的菜单层数,默认0,0是显示所有层
  45. 'depth' => 0,
  46. //调用一个对象定义显示导航菜单
  47. 'walker' => new Walker_Nav_Menu(),
  48. //指定显示的导航名,如果没有设置,则显示第一个
  49. 'theme_location' => 'primary'
  50. );
  51. ?>