diff --git a/src/wp-admin/css/admin-menu.css b/src/wp-admin/css/admin-menu.css index f4da4e4be6..b8bf6b26d9 100644 --- a/src/wp-admin/css/admin-menu.css +++ b/src/wp-admin/css/admin-menu.css @@ -610,6 +610,11 @@ li#wp-admin-bar-menu-toggle { display: none; } +/* Hide-if-customize for items we can't add classes to */ +.customize-support #menu-appearance a[href="themes.php?page=custom-header"], +.customize-support #menu-appearance a[href="themes.php?page=custom-background"] { + display: none; +} /* Auto-folding of the admin menu */ @media only screen and (max-width: 960px) { diff --git a/src/wp-admin/custom-background.php b/src/wp-admin/custom-background.php index dc1984210b..54fda523c3 100644 --- a/src/wp-admin/custom-background.php +++ b/src/wp-admin/custom-background.php @@ -238,6 +238,19 @@ class Custom_Background {

+ +
+

+ Customizer.' ), + admin_url( 'customize.php?autofocus[control]=background_image' ) + ); + ?> +

+
+ + updated ) ) { ?>

Visit your site to see how it looks.' ), home_url( '/' ) ); ?>

diff --git a/src/wp-admin/custom-header.php b/src/wp-admin/custom-header.php index 2527cc2cec..54fa49d54a 100644 --- a/src/wp-admin/custom-header.php +++ b/src/wp-admin/custom-header.php @@ -524,6 +524,19 @@ class Custom_Image_Header {

+ +
+

+ Customizer.' ), + admin_url( 'customize.php?autofocus[control]=header_image' ) + ); + ?> +

+
+ + updated ) ) { ?>

Visit your site to see how it looks.' ), home_url( '/' ) ); ?>

diff --git a/src/wp-admin/menu.php b/src/wp-admin/menu.php index 5fc718d532..fc0fb8d5bb 100644 --- a/src/wp-admin/menu.php +++ b/src/wp-admin/menu.php @@ -152,11 +152,23 @@ $menu[60] = array( __('Appearance'), $appearance_cap, 'themes.php', '', 'menu-to $customize_url = add_query_arg( 'return', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'customize.php' ); $submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', $customize_url, '', 'hide-if-no-customize' ); - unset( $customize_url ); + if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) { $submenu['themes.php'][10] = array(__( 'Menus' ), 'edit_theme_options', 'nav-menus.php'); } + if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize') ) { + $customize_header_url = add_query_arg( 'autofocus[control]', 'header_image', $customize_url ); + $submenu['themes.php'][15] = array( __( 'Header' ), $appearance_cap, $customize_header_url, '', 'hide-if-no-customize' ); + } + + if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize') ) { + $customize_background_url = add_query_arg( 'autofocus[control]', 'background_image', $customize_url ); + $submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, $customize_background_url, '', 'hide-if-no-customize' ); + } + + unset( $customize_url ); + unset( $appearance_cap ); // Add 'Editor' to the bottom of the Appearance menu. diff --git a/src/wp-admin/widgets.php b/src/wp-admin/widgets.php index 8bfce56b17..222251a1bb 100644 --- a/src/wp-admin/widgets.php +++ b/src/wp-admin/widgets.php @@ -310,7 +310,18 @@ $errors = array( require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>
-

+

+%2$s', + admin_url( 'customize.php?autofocus[panel]=widgets' ), + __( 'Manage in Customizer' ) + ); + } +?> +

diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index 726c50a8cd..8331af5293 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -662,13 +662,14 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) { if ( ! current_user_can( 'edit_theme_options' ) ) 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() ); if ( current_user_can( 'customize' ) ) { - $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'customize', 'title' => __('Customize'), - 'href' => add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ), + 'href' => $customize_url, 'meta' => array( 'class' => 'hide-if-no-customize', ), @@ -682,11 +683,54 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) { if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) $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' => 'appearance', 'id' => 'background', 'title' => __('Background'), 'href' => admin_url('themes.php?page=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' ), + 'meta' => array( + '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' ) ) { + $wp_admin_bar->add_menu( array( + 'parent' => 'appearance', + 'id' => 'header', + 'title' => __( 'Header' ), + 'href' => admin_url( 'themes.php?page=custom-header' ), + 'meta' => array( + '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', + ), + ) ); + } + } - 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') ) ); } /**