WordPress建站教程:wp_nav_menu() 参数说明

前端之家收集整理的这篇文章主要介绍了WordPress建站教程:wp_nav_menu() 参数说明前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我们在使用wordpress建站的过程中,基本上全是使用 wp_nav_menu() 这个函数调用菜单。但是建站这么久了,我们对 wp_nav_menu() 这个函数由多少了解呢?是否明白里面的参数所代表的意义呢?今天我们就来详细介绍一下这个函数里面参数的意义。通过下面的代码注释相信你能了解很多信息。

Crayon-5c891d2b8a76d904868603" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-mixed-highlight" title="Contains Mixed Languages">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891d2b8a76d904868603-1">1
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2b8a76d904868603-2">2
Crayon-num" data-line="Crayon-5c891d2b8a76d904868603-3">3
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2b8a76d904868603-4">4
Crayon-num" data-line="Crayon-5c891d2b8a76d904868603-5">5
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2b8a76d904868603-6">6
Crayon-num" data-line="Crayon-5c891d2b8a76d904868603-7">7
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2b8a76d904868603-8">8
Crayon-num" data-line="Crayon-5c891d2b8a76d904868603-9">9
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2b8a76d904868603-10">10
Crayon-num" data-line="Crayon-5c891d2b8a76d904868603-11">11
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2b8a76d904868603-12">12
Crayon-num" data-line="Crayon-5c891d2b8a76d904868603-13">13
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2b8a76d904868603-14">14
Crayon-num" data-line="Crayon-5c891d2b8a76d904868603-15">15
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2b8a76d904868603-16">16
Crayon-num" data-line="Crayon-5c891d2b8a76d904868603-17">17
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2b8a76d904868603-18">18
Crayon-num" data-line="Crayon-5c891d2b8a76d904868603-19">19
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2b8a76d904868603-20">20
Crayon-num" data-line="Crayon-5c891d2b8a76d904868603-21">21
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891d2b8a76d904868603-1">Crayon-ta">PHP
Crayon-line Crayon-striped-line" id="Crayon-5c891d2b8a76d904868603-2">Crayon-v">$defaultsCrayon-h"> Crayon-o">=Crayon-h"> Crayon-t">arrayCrayon-sy">(
Crayon-line" id="Crayon-5c891d2b8a76d904868603-3">Crayon-h"> Crayon-s">'theme_location'Crayon-h">Crayon-o">=Crayon-h"> Crayon-s">''Crayon-sy">,Crayon-h"> Crayon-c">//指定显示的导航名,如果没有设置,则显示第一个
Crayon-line Crayon-striped-line" id="Crayon-5c891d2b8a76d904868603-4">Crayon-h"> Crayon-s">'menu'Crayon-h">Crayon-o">=Crayon-h"> Crayon-s">''Crayon-sy">,
Crayon-line" id="Crayon-5c891d2b8a76d904868603-5">Crayon-h"> Crayon-s">'container'Crayon-h"> Crayon-o">=Crayon-h"> Crayon-s">'div'Crayon-sy">,Crayon-h"> Crayon-c">//最外层容器的标签名,默认div
Crayon-line Crayon-striped-line" id="Crayon-5c891d2b8a76d904868603-6">Crayon-h"> Crayon-s">'container_class'Crayon-h"> Crayon-o">=Crayon-h"> Crayon-s">''Crayon-sy">,Crayon-h"> Crayon-c">//最外层容器的class名
Crayon-line" id="Crayon-5c891d2b8a76d904868603-7">Crayon-h"> Crayon-s">'container_id'Crayon-h">Crayon-o">=Crayon-h"> Crayon-s">''Crayon-sy">,Crayon-h"> Crayon-c">//最外层容器的id名
Crayon-line Crayon-striped-line" id="Crayon-5c891d2b8a76d904868603-8">Crayon-h"> Crayon-s">'menu_class'Crayon-h">Crayon-o">=Crayon-h"> Crayon-s">'menu'Crayon-sy">,Crayon-h"> Crayon-c">//导航菜单ul标签的class名
Crayon-line" id="Crayon-5c891d2b8a76d904868603-9">Crayon-h"> Crayon-s">'menu_id'Crayon-h"> Crayon-o">=Crayon-h"> Crayon-s">''Crayon-sy">,Crayon-h"> Crayon-c">//导航菜单ul标签的id名
Crayon-line Crayon-striped-line" id="Crayon-5c891d2b8a76d904868603-10">Crayon-h"> Crayon-s">'echo'Crayon-h">Crayon-o">=Crayon-h"> Crayon-t">trueCrayon-sy">,Crayon-h"> Crayon-c">//是否打印,默认是true,如果想将导航的代码作为赋值使用,可设置为false
Crayon-line" id="Crayon-5c891d2b8a76d904868603-11">Crayon-h"> Crayon-s">'fallback_cb'Crayon-h"> Crayon-o">=Crayon-h"> Crayon-s">'wp_page_menu'Crayon-sy">,Crayon-h"> Crayon-c">//备用的导航菜单函数,用于没有在后台设置导航时调用
Crayon-line Crayon-striped-line" id="Crayon-5c891d2b8a76d904868603-12">Crayon-h"> Crayon-s">'before'Crayon-h">Crayon-o">=Crayon-h"> Crayon-s">''Crayon-sy">,Crayon-h"> Crayon-c">//显示在导航a标签之前
Crayon-line" id="Crayon-5c891d2b8a76d904868603-13">Crayon-h"> Crayon-s">'after'Crayon-h"> Crayon-o">=Crayon-h"> Crayon-s">''Crayon-sy">,Crayon-h"> Crayon-c">//显示在导航a标签之后
Crayon-line Crayon-striped-line" id="Crayon-5c891d2b8a76d904868603-14">Crayon-h"> Crayon-s">'link_before'Crayon-h"> Crayon-o">=Crayon-h"> Crayon-s">''Crayon-sy">,Crayon-h"> Crayon-c">//显示在导航链接名之前
Crayon-line" id="Crayon-5c891d2b8a76d904868603-15">Crayon-h"> Crayon-s">'link_after'Crayon-h">Crayon-o">=Crayon-h"> Crayon-s">''Crayon-sy">,Crayon-h"> Crayon-c">//显示在导航链接名之后
Crayon-line Crayon-striped-line" id="Crayon-5c891d2b8a76d904868603-16">Crayon-h"> Crayon-s">'items_wrap'Crayon-h">Crayon-o">=Crayon-h"> Crayon-s">'
    'Crayon-sy">,
Crayon-line" id="Crayon-5c891d2b8a76d904868603-17">Crayon-h"> Crayon-s">'depth'Crayon-h"> Crayon-o">=Crayon-h"> Crayon-cn">0Crayon-sy">,Crayon-h"> Crayon-c">//显示菜单层数,默认0,0是显示所有层
Crayon-line Crayon-striped-line" id="Crayon-5c891d2b8a76d904868603-18">Crayon-h"> Crayon-s">'walker'Crayon-h">Crayon-o">=Crayon-h"> Crayon-s">''Crayon-h"> Crayon-c">//调用一个对象定义显示导航菜单
Crayon-line" id="Crayon-5c891d2b8a76d904868603-19">Crayon-sy">)Crayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d2b8a76d904868603-20">Crayon-e">wp_nav_menuCrayon-sy">(Crayon-h"> Crayon-v">$defaultsCrayon-h"> Crayon-sy">)Crayon-sy">;Crayon-c">//显示菜单
Crayon-line" id="Crayon-5c891d2b8a76d904868603-21">

猜你在找的wordpress相关文章