在wordpress中wp_nav_menu()菜單中,介紹全部英文的對于我們來講很不方便閱讀了,下面我找到一個中文的wp_nav_menu()菜單參數介紹,下面與大家分享.
wp_nav_menu參數詳解:
- $menu_args = array(
- //最外層容器的標簽名,默認div
- ‘container’ => ‘div’,
- //最外層容器的class名
- ‘container_class’ => ‘mainNavBlock’,
- //最外層容器的id名
- ‘container_id’ => ‘menu’,
- //導航菜單ul標簽的class名
- ‘menu_class’ => ‘mainNav’,
- //導航菜單ul標簽的id名
- ‘menu_id’ => “nav”,
- //是否打印,默認是true,如果想將導航的代碼作為賦值使用,可設置為false
- ‘echo’ => true,
- //備用的導航菜單函數,用于沒有在后臺設置導航時調用
- ‘fallback_cb’ => ‘the_main_nav’,
- //顯示在導航a標簽之前
- ‘before’ => ‘’,
- //顯示在導航a標簽之后
- ‘after’ => ‘’,
- //顯示在導航鏈接名之前
- ‘link_before’ => ‘’,
- //顯示在導航鏈接名之后
- ‘link_after’ => ‘’,
- //顯示的菜單層數,默認0,0是顯示所有層
- ‘depth’ => 0,
- //調用一個對象定義顯示導航菜單
- ‘walker’ => new Walker_Nav_Menu(),
- //指定顯示的導航名,如果沒有設置,則顯示第一個
- ‘theme_location’ => ‘primary’,
- );
新聞熱點
疑難解答
圖片精選