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. Built from https://develop.svn.wordpress.org/trunk@30459 git-svn-id: http://core.svn.wordpress.org/trunk@30450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
58dfcb9bb0
commit
cffba3c1ba
|
@ -610,6 +610,11 @@ li#wp-admin-bar-menu-toggle {
|
||||||
display: none;
|
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 */
|
/* Auto-folding of the admin menu */
|
||||||
@media only screen and (max-width: 960px) {
|
@media only screen and (max-width: 960px) {
|
||||||
|
|
|
@ -610,6 +610,11 @@ li#wp-admin-bar-menu-toggle {
|
||||||
display: none;
|
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 */
|
/* Auto-folding of the admin menu */
|
||||||
@media only screen and (max-width: 960px) {
|
@media only screen and (max-width: 960px) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -238,6 +238,19 @@ class Custom_Background {
|
||||||
<div class="wrap" id="custom-background">
|
<div class="wrap" id="custom-background">
|
||||||
<h2><?php _e( 'Custom Background' ); ?></h2>
|
<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 ) ) { ?>
|
<?php if ( ! empty( $this->updated ) ) { ?>
|
||||||
<div id="message" class="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>
|
<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">
|
<div class="wrap">
|
||||||
<h2><?php _e( 'Custom Header' ); ?></h2>
|
<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 ) ) { ?>
|
<?php if ( ! empty( $this->updated ) ) { ?>
|
||||||
<div id="message" class="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>
|
<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' );
|
$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' );
|
$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' ) ) {
|
if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
|
||||||
$submenu['themes.php'][10] = array(__( 'Menus' ), 'edit_theme_options', 'nav-menus.php');
|
$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 );
|
unset( $appearance_cap );
|
||||||
|
|
||||||
// Add 'Editor' to the bottom of the Appearance menu.
|
// Add 'Editor' to the bottom of the Appearance menu.
|
||||||
|
|
|
@ -310,7 +310,18 @@ $errors = array(
|
||||||
require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>
|
require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>
|
||||||
|
|
||||||
<div class="wrap">
|
<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']]) ) { ?>
|
<?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) { ?>
|
||||||
<div id="message" class="updated"><p><?php echo $messages[$_GET['message']]; ?></p></div>
|
<div id="message" class="updated"><p><?php echo $messages[$_GET['message']]; ?></p></div>
|
||||||
|
|
|
@ -662,13 +662,14 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
|
||||||
if ( ! current_user_can( 'edit_theme_options' ) )
|
if ( ! current_user_can( 'edit_theme_options' ) )
|
||||||
return;
|
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' ) ) {
|
if ( current_user_can( 'customize' ) ) {
|
||||||
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
|
||||||
$wp_admin_bar->add_menu( array(
|
$wp_admin_bar->add_menu( array(
|
||||||
'parent' => 'appearance',
|
'parent' => 'appearance',
|
||||||
'id' => 'customize',
|
'id' => 'customize',
|
||||||
'title' => __('Customize'),
|
'title' => __('Customize'),
|
||||||
'href' => add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ),
|
'href' => $customize_url,
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'class' => 'hide-if-no-customize',
|
'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' ) )
|
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') ) );
|
$wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __('Menus'), 'href' => admin_url('nav-menus.php') ) );
|
||||||
|
|
||||||
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' ),
|
||||||
|
'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') ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.1-beta1-30458';
|
$wp_version = '4.1-beta1-30459';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue