返回介绍

wp_admin_bar_render()

发布于 2017-09-11 11:21:34 字数 2253 浏览 1071 评论 0 收藏 0

wp_admin_bar_render()

Renders the admin bar to the page based on the $wp_admin_bar->menu member var.


description

This is called very late on the footer actions so that it will render after anything else being added to the footer.

It includes the ‘admin_bar_menu’ action which should be used to hook in and add new menus to the admin bar. That way you can be sure that you are adding at most optimal point, right before the admin bar is rendered. This also gives you access to the $post global, among others.


源代码

File: wp-includes/admin-bar.php

function wp_admin_bar_render() {
	global $wp_admin_bar;

	if ( ! is_admin_bar_showing() || ! is_object( $wp_admin_bar ) )
		return;

	/**
	 * Load all necessary admin bar items.
	 *
	 * This is the hook used to add, remove, or manipulate admin bar items.
	 *
	 * @since 3.1.0
	 *
	 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
	 */
	do_action_ref_array( 'admin_bar_menu', array( &$wp_admin_bar ) );

	/**
	 * Fires before the admin bar is rendered.
	 *
	 * @since 3.1.0
	 */
	do_action( 'wp_before_admin_bar_render' );

	$wp_admin_bar->render();

	/**
	 * Fires after the admin bar is rendered.
	 *
	 * @since 3.1.0
	 */
	do_action( 'wp_after_admin_bar_render' );
}

更新日志

Versiondescription
3.1.0Introduced.

相关函数

Uses

  • wp-includes/class-wp-admin-bar.php: WP_Admin_Bar::render()
  • wp-includes/admin-bar.php: is_admin_bar_showing()
  • wp-includes/admin-bar.php: admin_bar_menu
  • wp-includes/admin-bar.php: wp_before_admin_bar_render
  • wp-includes/admin-bar.php: wp_after_admin_bar_render
  • wp-includes/plugin.php: do_action_ref_array()
  • wp-includes/plugin.php: do_action()
  • Show 2 more uses Hide more uses

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文