久久机这里只有精品,国产69精品一区二区亚洲孕妇,91精品国产综合久久婷婷香蕉,午夜久久久久久电影

最新活動(dòng):電腦PC端+手機(jī)端+微網(wǎng)站+自適應(yīng)網(wǎng)頁多模板選擇-建站388元起價(jià)!!!
當(dāng)前位置:主頁 > 網(wǎng)站建設(shè) > wordpress主題開發(fā):導(dǎo)航菜單函數(shù)wp_nav_menu()使用方

wordpress主題開發(fā):導(dǎo)航菜單函數(shù)wp_nav_menu()使用方

時(shí)間:2023-07-23 11:07:23 閱讀: 文章分類: 網(wǎng)站建設(shè) 作者: 網(wǎng)站編輯員

導(dǎo)讀:建站技術(shù)建站技術(shù)我們?cè)谧鰓ordpress主題開發(fā)的時(shí)候,必不可少的是要讀取后臺(tái)外觀-菜單中的導(dǎo)航結(jié)構(gòu),那么就需要用到wp_nav_menu()函數(shù),本篇文章小編問大家介紹wp搭建網(wǎng)站信息技術(shù)網(wǎng)站。

搭建網(wǎng)站信息技術(shù)網(wǎng)站

我們?cè)谧鰓ordpress主題開發(fā)的時(shí)候,必不可少的是要讀取后臺(tái)外觀-菜單中的導(dǎo)航結(jié)構(gòu),那么就需要用到wp_nav_menu()函數(shù),本篇文章小編問大家介紹wp_nav_menu()函數(shù)的使用方法。 wordpress主題開發(fā):導(dǎo)航菜單函數(shù)wp_nav_menu()使用方法 wp_nav_menu()函數(shù)使用非常的簡單,只需要在你需要的地方放入以下代碼即可:

<?php wp_nav_menu($args) ;?>

其中$args是函數(shù)的參數(shù),下面會(huì)詳細(xì)說明:

<?php $defaults = array( 'theme_location' => '',//用于在調(diào)用導(dǎo)航菜單時(shí)指定注冊(cè)過的某一個(gè)導(dǎo)航菜單名,如果沒有指定,則顯示第一個(gè) 'menu' => '',//使用導(dǎo)航菜單的名稱調(diào)用菜單,可以是 id, slug, name (按順序匹配的) 。 'container' => 'div',//最外層容器標(biāo)簽名 'container_class' => '',//最外層容器class名 'container_id' => '',//最外層容器id值 'menu_class' => 'menu',//ul 節(jié)點(diǎn)的 class 屬性值。 'menu_id' => '',//ul 節(jié)點(diǎn)的 id 屬性值。 'echo' => true,//確定直接顯示導(dǎo)航菜單還是返回 HTML 片段,如果想將導(dǎo)航的代碼作為賦值使用,可設(shè)置為false。 'fallback_cb' => 'wp_page_menu',//備用的導(dǎo)航菜單函數(shù),用于沒有在后臺(tái)設(shè)置導(dǎo)航時(shí)調(diào)用 'before' => '',//顯示在導(dǎo)航a標(biāo)簽之前 'after' => '',//顯示在導(dǎo)航a標(biāo)簽之后 'link_before' => '',//顯示在導(dǎo)航鏈接名之前 'link_after' => '',//顯示在導(dǎo)航鏈接名之后 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',//使用字符串替換修改ul的class。 'depth' => 0,//顯示菜單的深度, 當(dāng)數(shù)值為 0 時(shí)顯示所有深度的菜單。 'walker' => ''//自定義的遍歷對(duì)象,調(diào)用一個(gè)對(duì)象定義顯示導(dǎo)航菜單。 ); wp_nav_menu( $defaults ); ?>

使用

<?php wp_nav_menu($args) ;?>

讀取出來的導(dǎo)航菜單HTML結(jié)構(gòu)如下

<div class="menu-%e5%af%bc%e8%88%aa-container"><ul id="menu-%e5%af%bc%e8%88%aa" class="menu"><li id="menu-item-62" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home menu-item-62"><a href="http://localhost/wordpress/" rel="external nofollow" rel="external nofollow" >首頁</a></li> <li id="menu-item-32" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-32"><a href="http://localhost/wordpress/category/html" rel="external nofollow" rel="external nofollow" >HTML</a></li> <li id="menu-item-33" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-33"><a href="http://localhost/wordpress/category/css" rel="external nofollow" rel="external nofollow" >CSS</a></li> <li id="menu-item-34" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-34"><a href="http://localhost/wordpress/category/javascript" rel="external nofollow" rel="external nofollow" >JavaScript</a></li> <li id="menu-item-35" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-35"><a href="http://localhost/wordpress/category/jquery" rel="external nofollow" rel="external nofollow" >jquery</a></li> <li id="menu-item-36" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-36"><a href="http://localhost/wordpress/category/php" rel="external nofollow" rel="external nofollow" >PHP</a></li> <li id="menu-item-37" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-37"><a href="http://localhost/wordpress/sample-page" rel="external nofollow" rel="external nofollow" >示例頁面</a></li> </ul></div>

關(guān)鍵詞標(biāo)簽: 建站 函數(shù) 使用方法

聲明: 本文由我的SEOUC技術(shù)文章主頁發(fā)布于:2023-07-23 ,文章wordpress主題開發(fā):導(dǎo)航菜單函數(shù)wp_nav_menu()使用方主要講述使用方法,函數(shù),建站網(wǎng)站建設(shè)源碼以及服務(wù)器配置搭建相關(guān)技術(shù)文章。轉(zhuǎn)載請(qǐng)保留鏈接: http://www.bifwcx.com/article/web_35326.html

我的IDC 網(wǎng)站建設(shè)技術(shù)SEOUC.COM
專注網(wǎng)站建設(shè),SEO優(yōu)化,小程序設(shè)計(jì)制作搭建開發(fā)定制網(wǎng)站等,數(shù)千家網(wǎng)站定制開發(fā)案例,網(wǎng)站推廣技術(shù)服務(wù)。
  • 5000+合作客服
  • 8年從業(yè)經(jīng)驗(yàn)
  • 150+覆蓋行業(yè)
  • 最新熱門源碼技術(shù)文章

    主站蜘蛛池模板: 陆丰市| 城步| 江口县| 安义县| 镇宁| 台东市| 江孜县| 桂林市| 淄博市| 河西区| 西畴县| 闸北区| 云南省| 舒城县| 雷山县| 平安县| 平原县| 大同市| 布拖县| 山西省| 连江县| 九寨沟县| 县级市| 阿拉善盟| 绥德县| 海淀区| 博客| 肇源县| 岱山县| 乡城县| 兰州市| 长白| 丹棱县| 雷州市| 咸阳市| 宁乡县| 来凤县| 云林县| 漠河县| 霍林郭勒市| 星子县|