Theme Customizer: As customize.php without a theme parameter defaults to the current theme, update wp_customize_url() to make $stylesheet optional and update references for the current theme.

see #19910, #20751, #20575.



git-svn-id: https://develop.svn.wordpress.org/trunk@20934 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-05-26 15:32:05 +00:00
parent cd3af4b6d1
commit e7e922b356
3 changed files with 10 additions and 5 deletions

View File

@ -120,7 +120,7 @@ $customize_title = sprintf( __( 'Customize “%s”' ), $ct->display('Na
?> ?>
<div id="current-theme" class="<?php echo esc_attr( $class ); ?>"> <div id="current-theme" class="<?php echo esc_attr( $class ); ?>">
<?php if ( $screenshot ) : ?> <?php if ( $screenshot ) : ?>
<a href="<?php echo wp_customize_url( $ct->get_stylesheet() ); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr( $customize_title ); ?>"> <a href="<?php echo wp_customize_url(); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr( $customize_title ); ?>">
<img src="<?php echo esc_url( $screenshot ); ?>" alt="<?php esc_attr_e( 'Current theme preview' ); ?>" /> <img src="<?php echo esc_url( $screenshot ); ?>" alt="<?php esc_attr_e( 'Current theme preview' ); ?>" />
</a> </a>
<img class="hide-if-customize" src="<?php echo esc_url( $screenshot ); ?>" alt="<?php esc_attr_e( 'Current theme preview' ); ?>" /> <img class="hide-if-customize" src="<?php echo esc_url( $screenshot ); ?>" alt="<?php esc_attr_e( 'Current theme preview' ); ?>" />
@ -141,7 +141,7 @@ $customize_title = sprintf( __( 'Customize &#8220;%s&#8221;' ), $ct->display('Na
</div> </div>
<div class="theme-options"> <div class="theme-options">
<a id="customize-current-theme-link" href="<?php echo wp_customize_url( $ct->get_stylesheet() ); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr( $customize_title ); ?>"><?php _e( 'Customize' )?></a> <a id="customize-current-theme-link" href="<?php echo wp_customize_url(); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr( $customize_title ); ?>"><?php _e( 'Customize' )?></a>
<span><?php _e( 'Options:' )?></span> <span><?php _e( 'Options:' )?></span>
<?php <?php
// Pretend you didn't see this. // Pretend you didn't see this.

View File

@ -580,7 +580,7 @@ function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
'parent' => 'appearance', 'parent' => 'appearance',
'id' => 'customize', 'id' => 'customize',
'title' => __('Customize'), 'title' => __('Customize'),
'href' => wp_customize_url(get_stylesheet()), 'href' => wp_customize_url(),
'meta' => array( 'meta' => array(
'class' => 'hide-if-no-customize', 'class' => 'hide-if-no-customize',
), ),

View File

@ -1615,9 +1615,14 @@ add_action( 'admin_enqueue_scripts', '_wp_customize_loader_settings' );
* Returns a URL to load the theme customizer. * Returns a URL to load the theme customizer.
* *
* @since 3.4.0 * @since 3.4.0
*
* @param string $stylesheet Optional. Theme to customize. Defaults to current theme.
*/ */
function wp_customize_url( $stylesheet ) { function wp_customize_url( $stylesheet = null ) {
return esc_url( admin_url( 'customize.php' ) . '?theme=' . $stylesheet ); $url = admin_url( 'customize.php' );
if ( $stylesheet )
$url .= '?theme=' . $stylesheet;
return esc_url( $url );
} }
/** /**