Admin Bar: Add a Themes submenu under Appearance, for consistency. fixes #15931.

git-svn-id: http://svn.automattic.com/wordpress/trunk@17741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-04-28 11:17:09 +00:00
parent 58aa6a124a
commit 65a9b98246
1 changed files with 7 additions and 3 deletions

View File

@ -218,14 +218,18 @@ function wp_admin_bar_comments_menu( $wp_admin_bar ) {
* @since 3.1.0
*/
function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
if ( !current_user_can('switch_themes') )
// You can have edit_theme_options but not switch_themes.
if ( ! current_user_can('switch_themes') && ! current_user_can( 'edit_theme_options' ) )
return;
$wp_admin_bar->add_menu( array( 'id' => 'appearance', 'title' => __('Appearance'), 'href' => admin_url('themes.php') ) );
if ( !current_user_can('edit_theme_options') )
if ( ! current_user_can( 'edit_theme_options' ) )
return;
if ( current_user_can( 'switch_themes' ) )
$wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __('Themes'), 'href' => admin_url('themes.php') ) );
if ( current_theme_supports( 'widgets' ) )
$wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __('Widgets'), 'href' => admin_url('widgets.php') ) );
@ -235,7 +239,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
if ( current_theme_supports( '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-uploads' ) )
if ( current_theme_supports( 'custom-header' ) )
$wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'header', 'title' => __('Header'), 'href' => admin_url('themes.php?page=custom-header') ) );
}