Make WordPress Core

Changeset 39123


Ignore:
Timestamp:
11/03/2016 07:01:16 PM (8 years ago)
Author:
joemcgill
Message:

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.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/custom-header.php

    r38719 r39123  
    640640    <?php endif;
    641641
    642     $default_image = get_theme_support( 'custom-header', 'default-image' );
     642    $default_image = sprintf( get_theme_support( 'custom-header', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() );
    643643    if ( $default_image && get_header_image() != $default_image ) : ?>
    644644<tr>
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r39100 r39123  
    34403440
    34413441        $this->add_setting( new WP_Customize_Filter_Setting( $this, 'header_image', array(
    3442             'default'        => get_theme_support( 'custom-header', 'default-image' ),
     3442            'default'        => sprintf( get_theme_support( 'custom-header', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() ),
    34433443            'theme_supports' => 'custom-header',
    34443444        ) ) );
    34453445
    34463446        $this->add_setting( new WP_Customize_Header_Image_Setting( $this, 'header_image_data', array(
    3447             // 'default'        => get_theme_support( 'custom-header', 'default-image' ),
    34483447            'theme_supports' => 'custom-header',
    34493448        ) ) );
Note: See TracChangeset for help on using the changeset viewer.