Class Reference/WP Admin Bar

来自WordPress中文文档
(重定向自Wp admin bar
跳转至: 导航搜索

Role of WP_Admin_Bar

WP_Admin_Bar is WordPress' class for generating the Toolbar that lines the top of of WordPress sites when signed in. This class can be hooked and modified to add or remove options that appear in the admin bar.

The Toolbar replaces the Admin Bar since WordPress Version 3.3.

Usage

This class is used internally by WordPress to create an object called $wp_admin_bar. Most modifications to WordPress toolbar will generally be done by modifying the $wp_admin_bar object with the wp_before_admin_bar_render hook, and NOT necessarily through WP_Admin_Bar's internal hooks.

Methods and Properties

Properties

$nodes
An associative array containing the toolbar items (also called "nodes").
$bound
$user

Methods

__get()
initialize()
add_menu()
Add an item into the Admin bar.
remove_menu()
Remove an item from the Admin bar.
add_node()
Add a node to the menu.
_set_node()
get_node()
Gets a node.
_get_node()
get_nodes()
Gets nodes.
_get_nodes()
add_group()
Add a group to a menu node.
remove_node()
Remove any pre-defined node from the object.
_unset_node()
render()
_bind()
_render()
_render_container()
_render_group()
_render_item()
recursive_render()
add_menus()

Hooks

  • admin_bar_init - This action hook is called at the very end of initialization.
  • add_admin_bar_menus - This action hook is called at the end of the public add_menus() method.

Please note that the hooks are available for modifying this class but they have very limited use. In many cases, you will simply want to modify the $wp_admin_bar object.

Source File

WP_Admin_Bar is located in onlyincludecodewp-includes/class-wp-admin-bar.php/code/onlyinclude

div class=template-description style=padding: 0 1.5em; border: 1px solid #eeeeee; background-color: #f9f9f9

Template Description

Link to the source code on http://core.trac.wordpress.org/browser/.

Parameters

  1. filename
  2. (option) path to codetag/code (version) or codetrunk/code. This option is only used for a new function.br /Default: codetrunk/code -- trunk is the latest bleeding edge development version of WordPress.

Usage

Link to the stable version: pre检查到模板循环:模板:Trac/pre

Link to trunk: pre检查到模板循环:模板:Trac/pre

/div

wordpress.org.cn.

Resources

Related

模板:Toolbar Tags

模板:Class Footer