- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
「関数リファレンス/register nav menu」の版間の差分
細 (テンプレートタグガイド挿入等/翻訳者募集中) |
細 (見出し部分) |
||
2行目: | 2行目: | ||
{{テンプレートタグガイド|PHP}} | {{テンプレートタグガイド|PHP}} | ||
− | == | + | == 説明 == |
Registers a ''single'' [[Navigation Menus|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. | Registers a ''single'' [[Navigation Menus|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. | ||
8行目: | 8行目: | ||
See [[関数リファレンス/register_nav_menus|register_nav_menus()]] for creating multiple menus at once. | See [[関数リファレンス/register_nav_menus|register_nav_menus()]] for creating multiple menus at once. | ||
− | == | + | == 使い方 == |
<?php register_nav_menu( $location, $description ); ?> | <?php register_nav_menu( $location, $description ); ?> | ||
− | == | + | == パラメータ == |
{{Parameter|$location|string|Menu location identifier, like a slug.}} | {{Parameter|$location|string|Menu location identifier, like a slug.}} | ||
18行目: | 18行目: | ||
{{Parameter|$description|string|The default value to return if no value is returned (ie. the option is not in the database).}} | {{Parameter|$description|string|The default value to return if no value is returned (ie. the option is not in the database).}} | ||
− | == | + | == 戻り値 == |
None. | None. | ||
− | == | + | == 用例 == |
<pre> | <pre> | ||
30行目: | 30行目: | ||
</pre> | </pre> | ||
− | == | + | == 注 == |
* This function automatically registers custom menu support for the theme therefore you do '''not''' need to call <code>add_theme_support( 'menus' );</code> | * This function automatically registers custom menu support for the theme therefore you do '''not''' need to call <code>add_theme_support( 'menus' );</code> | ||
43行目: | 43行目: | ||
* Use [[テンプレートタグ/wp_nav_menu|wp_nav_menu()]] to display your custom menu. | * Use [[テンプレートタグ/wp_nav_menu|wp_nav_menu()]] to display your custom menu. | ||
− | == | + | == 変更履歴 == |
− | * | + | * [[Version 3.0|3.0.0]] にて導入されました。 |
− | == | + | == ソースファイル == |
<tt>register_nav_menu()</tt> is located in {{Trac|wp-includes/nav-menu.php}}. | <tt>register_nav_menu()</tt> is located in {{Trac|wp-includes/nav-menu.php}}. | ||
53行目: | 53行目: | ||
{{原文|Function Reference/register_nav_menu|92980}}<!-- 11:51, 15 September 2010 bono 版 --> | {{原文|Function Reference/register_nav_menu|92980}}<!-- 11:51, 15 September 2010 bono 版 --> | ||
− | == | + | == 関連 == |
{{Navigation Menu Tags}} | {{Navigation Menu Tags}} |
2015年5月7日 (木) 13:04時点における版
このページ「関数リファレンス/register nav menu」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています。
タグ一覧: テンプレートタグ | インクルードタグ | 条件分岐タグ | その他の関数 | Code Reference
使い方: テンプレートタグ入門 | パラメータの渡し方 | 初心者の方へ | その他のテーマ関連資料
説明
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.
使い方
<?php register_nav_menu( $location, $description ); ?>
パラメータ
- $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).
- 初期値: なし
戻り値
None.
用例
if ( function_exists( 'register_nav_menu' ) ) { register_nav_menu( 'pluginbuddy_mobile', 'PluginBuddy Mobile Navigation Menu' ); }
注
- 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.
変更履歴
- 3.0.0 にて導入されました。
ソースファイル
register_nav_menu() is located in wp-includes/nav-menu.php
.
最新英語版: WordPress Codex » Function Reference/register_nav_menu (最新版との差分)
関連
ナビゲーションメニュー: register_nav_menus(), register_nav_menu(), unregister_nav_menu() /en , has_nav_menu(), wp_nav_menu(), wp_get_nav_menu_items()