mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Customizer: Use deep-links for Backgrounds, Headers, and Widgets.
Replace links in admin menu and toolbar to Custom Background/Header screen with deep-links to the Customizer section. On the Widgets screen display a link to the Customizer widgets panel. props topher1kenobe, rzen, celloexpressions, westonruter fixes #25569, #25571, #28032. git-svn-id: https://develop.svn.wordpress.org/trunk@30459 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -238,6 +238,19 @@ class Custom_Background {
|
||||
<div class="wrap" id="custom-background">
|
||||
<h2><?php _e( 'Custom Background' ); ?></h2>
|
||||
|
||||
<?php if ( current_user_can( 'customize' ) ) { ?>
|
||||
<div class="update-nag hide-if-no-customize">
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
__( 'You can now manage and live-preview Custom Backgrounds in the <a href="%1$s">Customizer</a>.' ),
|
||||
admin_url( 'customize.php?autofocus[control]=background_image' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( ! empty( $this->updated ) ) { ?>
|
||||
<div id="message" class="updated">
|
||||
<p><?php printf( __( 'Background updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p>
|
||||
|
||||
@@ -524,6 +524,19 @@ class Custom_Image_Header {
|
||||
<div class="wrap">
|
||||
<h2><?php _e( 'Custom Header' ); ?></h2>
|
||||
|
||||
<?php if ( current_user_can( 'customize' ) ) { ?>
|
||||
<div class="update-nag hide-if-no-customize">
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
__( 'You can now manage and live-preview Custom Header in the <a href="%1$s">Customizer</a>.' ),
|
||||
admin_url( 'customize.php?autofocus[control]=header_image' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( ! empty( $this->updated ) ) { ?>
|
||||
<div id="message" class="updated">
|
||||
<p><?php printf( __( 'Header updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p>
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -310,7 +310,18 @@ $errors = array(
|
||||
require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php echo esc_html( $title ); ?></h2>
|
||||
<h2>
|
||||
<?php
|
||||
echo esc_html( $title );
|
||||
if ( current_user_can( 'customize' ) ) {
|
||||
printf(
|
||||
' <a class="add-new-h2 hide-if-no-customize" href="%1$s">%2$s</a>',
|
||||
admin_url( 'customize.php?autofocus[panel]=widgets' ),
|
||||
__( 'Manage in Customizer' )
|
||||
);
|
||||
}
|
||||
?>
|
||||
</h2>
|
||||
|
||||
<?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) { ?>
|
||||
<div id="message" class="updated"><p><?php echo $messages[$_GET['message']]; ?></p></div>
|
||||
|
||||
Reference in New Issue
Block a user