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

git-svn-id: https://develop.svn.wordpress.org/trunk@17741 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2011-04-28 11:17:09 +00:00
parent 81755c790e
commit a33d4a8dc4
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 * @since 3.1.0
*/ */
function wp_admin_bar_appearance_menu( $wp_admin_bar ) { 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; return;
$wp_admin_bar->add_menu( array( 'id' => 'appearance', 'title' => __('Appearance'), 'href' => admin_url('themes.php') ) ); $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; 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' ) ) if ( current_theme_supports( 'widgets' ) )
$wp_admin_bar->add_menu( array( 'parent' => 'appearance', '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') ) );
@ -235,7 +239,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
if ( current_theme_supports( 'custom-background' ) ) 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') ) ); $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') ) ); $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'header', 'title' => __('Header'), 'href' => admin_url('themes.php?page=custom-header') ) );
} }