Toolbar: Disambiguate links to the dashboard vs. to the customizer.

All links in the site name menu now point to admin screens, and Customize is its own top-level link. This makes it clear which context you are about to enter.

fixes #32924. see #32678.

Built from https://develop.svn.wordpress.org/trunk@33130


git-svn-id: http://core.svn.wordpress.org/trunk@33101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2015-07-08 20:03:24 +00:00
parent 4ec14ee206
commit 28c1600e6e
7 changed files with 64 additions and 74 deletions

View File

@ -318,6 +318,33 @@ function wp_admin_bar_site_menu( $wp_admin_bar ) {
}
}
/**
* Add the "Customize" link.
*
* @since 4.3.0
*
* @param WP_Admin_Bar $wp_admin_bar
*/
function wp_admin_bar_customize_menu( $wp_admin_bar ) {
// Don't show for users who can't access the customizer.
if ( ! current_user_can( 'customize' ) ) {
return;
}
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() );
$wp_admin_bar->add_menu( array(
'id' => 'customize',
'title' => __( 'Customize' ),
'href' => $customize_url,
'meta' => array(
'class' => 'hide-if-no-customize',
),
) );
add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
}
/**
* Add the "My Sites/[Site Name]" menu and all submenus.
*
@ -664,44 +691,13 @@ function wp_admin_bar_comments_menu( $wp_admin_bar ) {
function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
$wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance' ) );
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() );
if ( current_user_can( 'switch_themes' ) ) {
$wp_admin_bar->add_menu( array(
'parent' => 'appearance',
'id' => 'themes',
'title' => __( 'Themes' ),
'href' => admin_url( 'themes.php' ),
'meta' => array(
'class' => 'hide-if-customize',
),
) );
if ( current_user_can( 'customize' ) ) {
$wp_admin_bar->add_menu( array(
'parent' => 'appearance',
'id' => 'customize-themes',
'title' => __( 'Themes' ),
'href' => add_query_arg( urlencode( 'autofocus[section]' ), 'themes', $customize_url ), // urlencode() needed due to #16859
'meta' => array(
'class' => 'hide-if-no-customize',
),
) );
}
}
if ( current_user_can( 'customize' ) ) {
$wp_admin_bar->add_menu( array(
'parent' => 'appearance',
'id' => 'customize',
'title' => __('Customize'),
'href' => $customize_url,
'meta' => array(
'class' => 'hide-if-no-customize',
),
) );
add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
}
if ( ! current_user_can( 'edit_theme_options' ) ) {
@ -714,22 +710,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
'id' => 'widgets',
'title' => __( 'Widgets' ),
'href' => admin_url( 'widgets.php' ),
'meta' => array(
'class' => 'hide-if-customize',
),
) );
if ( current_user_can( 'customize' ) ) {
$wp_admin_bar->add_menu( array(
'parent' => 'appearance',
'id' => 'customize-widgets',
'title' => __( 'Widgets' ),
'href' => add_query_arg( urlencode( 'autofocus[panel]' ), 'widgets', $customize_url ), // urlencode() needed due to #16859
'meta' => array(
'class' => 'hide-if-no-customize',
),
) );
}
}
if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
@ -745,18 +726,6 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
'class' => 'hide-if-customize',
),
) );
if ( current_user_can( 'customize' ) ) {
$wp_admin_bar->add_menu( array(
'parent' => 'appearance',
'id' => 'customize-background',
'title' => __( 'Background' ),
'href' => add_query_arg( urlencode( 'autofocus[control]' ), 'background_image', $customize_url ), // urlencode() needed due to #16859
'meta' => array(
'class' => 'hide-if-no-customize',
),
) );
}
}
if ( current_theme_supports( 'custom-header' ) ) {
@ -769,18 +738,6 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
'class' => 'hide-if-customize',
),
) );
if ( current_user_can( 'customize' ) ) {
$wp_admin_bar->add_menu( array(
'parent' => 'appearance',
'id' => 'customize-header',
'title' => __( 'Header' ),
'href' => add_query_arg( urlencode( 'autofocus[control]' ), 'header_image', $customize_url ), // urlencode() needed due to #16859
'meta' => array(
'class' => 'hide-if-no-customize',
),
) );
}
}
}

View File

@ -556,7 +556,8 @@ class WP_Admin_Bar {
add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 );
add_action( 'admin_bar_menu', 'wp_admin_bar_site_menu', 30 );
add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 40 );
add_action( 'admin_bar_menu', 'wp_admin_bar_customize_menu', 40 );
add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 50 );
// Content related.
if ( ! is_network_admin() && ! is_user_admin() ) {

View File

@ -521,6 +521,12 @@ html:lang(he-il) .rtl #wpadminbar * {
top: 2px;
}
#wpadminbar #wp-admin-bar-customize > .ab-item:before {
content: '\f540';
top: 2px;
}
#wpadminbar #wp-admin-bar-edit > .ab-item:before {
content: '\f464';
top: 2px;
@ -882,6 +888,7 @@ html:lang(he-il) .rtl #wpadminbar * {
/* My Sites and "Site Title" menu */
#wpadminbar #wp-admin-bar-my-sites > .ab-item,
#wpadminbar #wp-admin-bar-site-name > .ab-item,
#wpadminbar #wp-admin-bar-customize > .ab-item,
#wpadminbar #wp-admin-bar-edit > .ab-item,
#wpadminbar #wp-admin-bar-my-account > .ab-item {
text-indent: 100%;
@ -903,6 +910,7 @@ html:lang(he-il) .rtl #wpadminbar * {
#wpadminbar #wp-admin-bar-edit > .ab-item:before,
#wpadminbar #wp-admin-bar-my-sites > .ab-item:before,
#wpadminbar #wp-admin-bar-site-name > .ab-item:before,
#wpadminbar #wp-admin-bar-customize > .ab-item:before,
#wpadminbar #wp-admin-bar-my-account > .ab-item:before {
display: block;
text-indent: 0;
@ -1016,6 +1024,7 @@ html:lang(he-il) .rtl #wpadminbar * {
#wpadminbar li#wp-admin-bar-my-sites,
#wpadminbar li#wp-admin-bar-updates,
#wpadminbar li#wp-admin-bar-site-name,
#wpadminbar li#wp-admin-bar-customize,
#wpadminbar li#wp-admin-bar-new-content,
#wpadminbar li#wp-admin-bar-edit,
#wpadminbar li#wp-admin-bar-comments,
@ -1130,3 +1139,10 @@ html:lang(he-il) .rtl #wpadminbar * {
box-shadow: none;
}
}
/* Very narrow screens */
@media screen and (max-width: 400px) {
#wpadminbar li#wp-admin-bar-comments {
display: none;
}
}

File diff suppressed because one or more lines are too long

View File

@ -521,6 +521,12 @@ html:lang(he-il) .rtl #wpadminbar * {
top: 2px;
}
#wpadminbar #wp-admin-bar-customize > .ab-item:before {
content: '\f540';
top: 2px;
}
#wpadminbar #wp-admin-bar-edit > .ab-item:before {
content: '\f464';
top: 2px;
@ -882,6 +888,7 @@ html:lang(he-il) .rtl #wpadminbar * {
/* My Sites and "Site Title" menu */
#wpadminbar #wp-admin-bar-my-sites > .ab-item,
#wpadminbar #wp-admin-bar-site-name > .ab-item,
#wpadminbar #wp-admin-bar-customize > .ab-item,
#wpadminbar #wp-admin-bar-edit > .ab-item,
#wpadminbar #wp-admin-bar-my-account > .ab-item {
text-indent: 100%;
@ -903,6 +910,7 @@ html:lang(he-il) .rtl #wpadminbar * {
#wpadminbar #wp-admin-bar-edit > .ab-item:before,
#wpadminbar #wp-admin-bar-my-sites > .ab-item:before,
#wpadminbar #wp-admin-bar-site-name > .ab-item:before,
#wpadminbar #wp-admin-bar-customize > .ab-item:before,
#wpadminbar #wp-admin-bar-my-account > .ab-item:before {
display: block;
text-indent: 0;
@ -1016,6 +1024,7 @@ html:lang(he-il) .rtl #wpadminbar * {
#wpadminbar li#wp-admin-bar-my-sites,
#wpadminbar li#wp-admin-bar-updates,
#wpadminbar li#wp-admin-bar-site-name,
#wpadminbar li#wp-admin-bar-customize,
#wpadminbar li#wp-admin-bar-new-content,
#wpadminbar li#wp-admin-bar-edit,
#wpadminbar li#wp-admin-bar-comments,
@ -1130,3 +1139,10 @@ html:lang(he-il) .rtl #wpadminbar * {
box-shadow: none;
}
}
/* Very narrow screens */
@media screen and (max-width: 400px) {
#wpadminbar li#wp-admin-bar-comments {
display: none;
}
}

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-beta1-33129';
$wp_version = '4.3-beta1-33130';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.