Hide 'Customize' toolbar item when customizer is not supported. fixes #20751, see #19910.

Removes script queue check for 'customize-loader' from wp_customize_support_script(), because we may want to check for customize-support on a page without the loader.


git-svn-id: http://core.svn.wordpress.org/trunk@20918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
koopersmith 2012-05-25 22:26:00 +00:00
parent a91c11b8a5
commit 69c970a4a1
4 changed files with 24 additions and 5 deletions

View File

@ -99,7 +99,12 @@ $admin_body_class .= ' no-customize-support';
document.body.className = document.body.className.replace('no-js','js');
</script>
<?php wp_customize_support_script(); ?>
<?php
// If the customize-loader script is enqueued, make sure the customize
// body classes are correct as early as possible.
if ( wp_script_is( 'customize-loader', 'queue' ) )
wp_customize_support_script();
?>
<div id="wpwrap">
<?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>

View File

@ -576,7 +576,16 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
if ( ! current_user_can( 'edit_theme_options' ) )
return;
$wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'customize', 'title' => __('Customize'), 'href' => wp_customize_url(get_stylesheet()) ) );
$wp_admin_bar->add_menu( array(
'parent' => 'appearance',
'id' => 'customize',
'title' => __('Customize'),
'href' => wp_customize_url(get_stylesheet()),
'meta' => array(
'class' => 'hide-if-no-customize',
),
) );
add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
if ( current_theme_supports( 'widgets' ) )
$wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __('Widgets'), 'href' => admin_url('widgets.php') ) );

View File

@ -581,6 +581,14 @@
background-position: -2px -203px;
}
/**
* Customize support classes
*/
.no-customize-support .hide-if-no-customize,
.customize-support .hide-if-customize {
display: none;
}
/**
* Retina display 2x icons
*/

View File

@ -1636,9 +1636,6 @@ function wp_customize_url( $stylesheet ) {
* @since 3.4.0
*/
function wp_customize_support_script() {
if ( ! wp_script_is( 'customize-loader', 'queue' ) )
return;
$admin_origin = parse_url( admin_url() );
$home_origin = parse_url( home_url() );
$cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) );