Ticket #22221: 22221.diff

File 22221.diff, 1.8 KB (added by nacin, 7 months ago)

Debug left in - best tested with Twenty Ten, as it has a default-image.

Line 
1Index: wp-includes/theme.php
2===================================================================
3--- wp-includes/theme.php       (revision 22260)
4+++ wp-includes/theme.php       (working copy)
5@@ -1025,7 +1025,27 @@
6  * @return object
7  */
8 function get_custom_header() {
9-       $data = is_random_header_image()? _get_random_header_data() : get_theme_mod( 'header_image_data' );
10+       global $_wp_default_headers;
11+
12+       if ( is_random_header_image() ) {
13+               $data = _get_random_header_data();
14+       } else {
15+               $data = get_theme_mod( 'header_image_data' );
16+               if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) {
17+                       $directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() );
18+                       $default_image = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args );
19+                       foreach ( $_wp_default_headers as $header => $details ) {
20+                               $url = vsprintf( $details['url'], $directory_args );
21+                               if ( $default_image == $url ) {
22+                                       $data = $details;
23+                                       $data['url'] = $url;
24+                                       $data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args );
25+                                       break;
26+                               }
27+                       }
28+               }
29+       }
30+
31        $default = array(
32                'url'           => '',
33                'thumbnail_url' => '',
34Index: wp-content/themes/twentyten/header.php
35===================================================================
36--- wp-content/themes/twentyten/header.php      (revision 22260)
37+++ wp-content/themes/twentyten/header.php      (working copy)
38@@ -84,6 +84,7 @@
39                                                echo get_the_post_thumbnail( $post->ID );
40                                        elseif ( get_header_image() ) :
41                                                // Compatibility with versions of WordPress prior to 3.4.
42+                                               var_dump( get_custom_header() );
43                                                if ( function_exists( 'get_custom_header' ) ) {
44                                                        $header_image_width  = get_custom_header()->width;
45                                                        $header_image_height = get_custom_header()->height;