- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
関数リファレンス/register nav menu
提供: WordPress Codex 日本語版
< 関数リファレンス
2010年9月15日 (水) 20:53時点におけるBono (トーク | 投稿記録)による版 (en:Function Reference/register_nav_menu 11:51, 15 September 2010 bono 版を翻訳用にコピー)
目次
Description
Registers a single custom navigation menu in the new custom menu editor of WordPress 3.0. This allows for creation of custom menus in the dashboard for use in your theme.
See register_nav_menus() for creating multiple menus at once.
Usage
%%% <?php register_nav_menu( $location, $description ); ?> %%%
Parameters
- $location
- (string) (必須) Menu location identifier, like a slug.
- 初期値: なし
- $description
- (string) (必須) The default value to return if no value is returned (ie. the option is not in the database).
- 初期値: なし
Return Values
None.
Examples
if ( function_exists( 'register_nav_menu' ) ) { register_nav_menu( 'pluginbuddy_mobile', 'PluginBuddy Mobile Navigation Menu' ); }
Notes
- This function automatically registers custom menu support for the theme therefore you do not need to call
add_theme_support( 'menus' );
- Verify the function exists prior to usage to provide backwards compatibility before WordPress 3.0.0:
if ( function_exists( 'register_nav_menu' ) ) { ... }
- This function actually works by simply calling register_nav_menus() in the following way:
register_nav_menus( array( $location => $description ) );
- Use wp_nav_menu() to display your custom menu.
Change Log
- Since: 3.0.0
Source File
register_nav_menu() is located in wp-includes/nav-menu.php
.
最新英語版: WordPress Codex » Function Reference/register nav menu (最新版との差分)
Related
ナビゲーションメニュー: register_nav_menus(), register_nav_menu(), unregister_nav_menu() /en , has_nav_menu(), wp_nav_menu(), wp_get_nav_menu_items()
関数リファレンス、テンプレートタグ目次もご覧ください。