Themes: Improve support for placeholders in default headers.

When themes register default headers, they can use sprintf style placeholder
strings in place of the template directory URI, which WordPress transforms
in several places by running the value of
`get_theme_support( 'custom-header', 'default-image' )` through `sprintf()`.

This fixes a few places where WordPress skipped the `sprintf()` step and
referenced the `get_theme_support()` value directly.

Props bradyvercher for initial patch.
See #38557.
Built from https://develop.svn.wordpress.org/trunk@39123


git-svn-id: http://core.svn.wordpress.org/trunk@39063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Joe McGill 2016-11-04 17:10:01 +00:00
parent 89cab4e197
commit 8fa49e77bd
3 changed files with 3 additions and 4 deletions

View File

@ -639,7 +639,7 @@ class Custom_Image_Header {
</tr> </tr>
<?php endif; <?php endif;
$default_image = get_theme_support( 'custom-header', 'default-image' ); $default_image = sprintf( get_theme_support( 'custom-header', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() );
if ( $default_image && get_header_image() != $default_image ) : ?> if ( $default_image && get_header_image() != $default_image ) : ?>
<tr> <tr>
<th scope="row"><?php _e( 'Reset Image' ); ?></th> <th scope="row"><?php _e( 'Reset Image' ); ?></th>

View File

@ -3439,12 +3439,11 @@ final class WP_Customize_Manager {
) ); ) );
$this->add_setting( new WP_Customize_Filter_Setting( $this, 'header_image', array( $this->add_setting( new WP_Customize_Filter_Setting( $this, 'header_image', array(
'default' => get_theme_support( 'custom-header', 'default-image' ), 'default' => sprintf( get_theme_support( 'custom-header', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() ),
'theme_supports' => 'custom-header', 'theme_supports' => 'custom-header',
) ) ); ) ) );
$this->add_setting( new WP_Customize_Header_Image_Setting( $this, 'header_image_data', array( $this->add_setting( new WP_Customize_Header_Image_Setting( $this, 'header_image_data', array(
// 'default' => get_theme_support( 'custom-header', 'default-image' ),
'theme_supports' => 'custom-header', 'theme_supports' => 'custom-header',
) ) ); ) ) );

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-beta1-39122'; $wp_version = '4.7-beta1-39123';
/** /**
* 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.