register_nav_menu() - WordPress 函数参考中文文档

返回介绍

register_nav_menu()

发布于 2017-09-11 字数1881 浏览 997 评论 0

register_nav_menu( string $location,  string $描述 )

Registers a navigation menu location for a theme.


描述


参数

$location

(string)
(Required)
Menu location identifier, like a slug.

$描述

(string)
(Required)
Menu location descriptive text.


源代码

File: wp-includes/nav-menu.php

function register_nav_menu( $location, $描述 ) {
	register_nav_menus( array( $location => $描述 ) );
}

更新日志

Version 描述
3.0.0 Introduced.

相关函数

Uses

  • wp-includes/nav-menu.php:
    register_nav_menus()

User Contributed Notes

  1. Skip to note content

    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note

    Contributed by Codex

    Register a “primary” nav menu” example

    
    register_nav_menu( 'primary', __( 'Primary Menu', 'theme-slug' ) );
    
  2. Register a navigation menu, extended example:

    
    add_action( 'after_setup_theme', 'register_primary_menu' );
    
    function register_primary_menu() {
    	register_nav_menu( 'primary', __( 'Primary Menu', 'theme-text-domain' ) );
    }
    

上一篇:register_meta()

下一篇:register_nav_menus()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!