WordPress.org

Make WordPress Core

Changeset 22669


Ignore:
Timestamp:
11/19/12 06:59:25 (17 months ago)
Author:
nacin
Message:

In get_custom_header(), support a default header that is registered using default-image but not register_default_headers(). fixes #22221.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r22545 r22669  
    10351035    } else { 
    10361036        $data = get_theme_mod( 'header_image_data' ); 
    1037         if ( ! $data && isset( $_wp_default_headers ) && current_theme_supports( 'custom-header', 'default-image' ) ) { 
     1037        if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) { 
    10381038            $directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() ); 
    1039             $default_image = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args ); 
    1040             foreach ( (array) $_wp_default_headers as $header => $details ) { 
    1041                 $url = vsprintf( $details['url'], $directory_args ); 
    1042                 if ( $default_image == $url ) { 
    1043                     $data = $details; 
    1044                     $data['url'] = $url; 
    1045                     $data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args ); 
    1046                     break; 
     1039            $data = array(); 
     1040            $data['url'] = $data['thumbnail_url'] = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args ); 
     1041            if ( ! empty( $_wp_default_headers ) ) { 
     1042                foreach ( (array) $_wp_default_headers as $default_header ) { 
     1043                    $url = vsprintf( $default_header['url'], $directory_args ); 
     1044                    if ( $data['url'] == $url ) { 
     1045                        $data = $default_header; 
     1046                        $data['url'] = $url; 
     1047                        $data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args ); 
     1048                        break; 
     1049                    } 
    10471050                } 
    10481051            } 
Note: See TracChangeset for help on using the changeset viewer.