From 18e0faf83ec15cd6082e1c5abf404f85fc5c2809 Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 23 Nov 2011 23:01:20 +0000 Subject: [PATCH] Use an 'appearance' group in the admin bar. fixes #19245. git-svn-id: http://svn.automattic.com/wordpress/trunk@19434 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/admin-bar.php | 12 +++++++----- wp-includes/class-wp-admin-bar.php | 7 ------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/wp-includes/admin-bar.php b/wp-includes/admin-bar.php index cdd9e7c93..ca4642dc3 100644 --- a/wp-includes/admin-bar.php +++ b/wp-includes/admin-bar.php @@ -538,23 +538,25 @@ function wp_admin_bar_comments_menu( $wp_admin_bar ) { * @since 3.1.0 */ function wp_admin_bar_appearance_menu( $wp_admin_bar ) { + $wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance' ) ); + if ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) ) - $wp_admin_bar->add_menu( array( 'parent' => 'site-name', 'id' => 'themes', 'title' => __('Themes'), 'href' => admin_url('themes.php') ) ); + $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __('Themes'), 'href' => admin_url('themes.php') ) ); if ( ! current_user_can( 'edit_theme_options' ) ) return; if ( current_theme_supports( 'widgets' ) ) - $wp_admin_bar->add_menu( array( 'parent' => 'site-name', 'id' => 'widgets', 'title' => __('Widgets'), 'href' => admin_url('widgets.php') ) ); + $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __('Widgets'), 'href' => admin_url('widgets.php') ) ); if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) - $wp_admin_bar->add_menu( array( 'parent' => 'site-name', 'id' => 'menus', 'title' => __('Menus'), 'href' => admin_url('nav-menus.php') ) ); + $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __('Menus'), 'href' => admin_url('nav-menus.php') ) ); if ( current_theme_supports( 'custom-background' ) ) - $wp_admin_bar->add_menu( array( 'parent' => 'site-name', 'id' => 'background', 'title' => __('Background'), 'href' => admin_url('themes.php?page=custom-background') ) ); + $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'background', 'title' => __('Background'), 'href' => admin_url('themes.php?page=custom-background') ) ); if ( current_theme_supports( 'custom-header' ) ) - $wp_admin_bar->add_menu( array( 'parent' => 'site-name', 'id' => 'header', 'title' => __('Header'), 'href' => admin_url('themes.php?page=custom-header') ) ); + $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'header', 'title' => __('Header'), 'href' => admin_url('themes.php?page=custom-header') ) ); } /** diff --git a/wp-includes/class-wp-admin-bar.php b/wp-includes/class-wp-admin-bar.php index 741914922..7a3e03243 100644 --- a/wp-includes/class-wp-admin-bar.php +++ b/wp-includes/class-wp-admin-bar.php @@ -126,16 +126,9 @@ class WP_Admin_Bar { public function render() { global $is_IE, $is_iphone; - $back_compat_parents = array( - 'appearance' => 'site-name', - ); - // Link nodes to parents. foreach ( $this->nodes as $node ) { - if ( isset( $back_compat_parents[ $node->parent ] ) ) - $node->parent = $back_compat_parents[ $node->parent ]; - // Handle root menu items if ( empty( $node->parent ) ) { $parent = $this->root;