Ticket #38557: 38557.3.diff
File 38557.3.diff, 5.2 KB (added by , 8 years ago) |
---|
-
src/wp-admin/custom-header.php
246 246 } 247 247 248 248 $this->default_headers = $_wp_default_headers; 249 $template_directory_uri = get_template_directory_uri();250 $stylesheet_directory_uri = get_stylesheet_directory_uri();251 foreach ( array_keys($this->default_headers) as $header ) {252 $this->default_headers[$header]['url'] = sprintf( $this->default_headers[$header]['url'], $template_directory_uri, $stylesheet_directory_uri );253 $this->default_headers[$header]['thumbnail_url'] = sprintf( $this->default_headers[$header]['thumbnail_url'], $template_directory_uri, $stylesheet_directory_uri );254 }255 249 } 256 250 257 251 /** … … 1080 1074 $this->remove_header_image(); 1081 1075 return; 1082 1076 } 1083 $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );1084 1077 1085 1078 $default_data = array(); 1086 1079 foreach ( $this->default_headers as $header => $details ) { … … 1333 1326 return $this->default_headers; // easy peasy. 1334 1327 } 1335 1328 1336 $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );1337 1329 $already_has_default = false; 1338 1330 1339 1331 foreach ( $this->default_headers as $k => $h ) { -
src/wp-includes/class-wp-customize-manager.php
3440 3440 ) ) ); 3441 3441 3442 3442 $this->add_setting( new WP_Customize_Header_Image_Setting( $this, 'header_image_data', array( 3443 // 'default' => get_theme_support( 'custom-header', 'default-image' ),3444 3443 'theme_supports' => 'custom-header', 3445 3444 ) ) ); 3446 3445 -
src/wp-includes/theme.php
1113 1113 $header_image_mod = get_theme_mod( 'header_image', '' ); 1114 1114 $headers = array(); 1115 1115 1116 if ( 'random-uploaded-image' == $header_image_mod ) 1116 if ( 'random-uploaded-image' == $header_image_mod ) { 1117 1117 $headers = get_uploaded_header_images(); 1118 elseif ( ! empty( $_wp_default_headers ) ) {1119 if ( 'random-default-image' == $header_image_mod ) {1118 } elseif ( ! empty( $_wp_default_headers ) ) { 1119 if ( 'random-default-image' == $header_image_mod || current_theme_supports( 'custom-header', 'random-default' ) ) { 1120 1120 $headers = $_wp_default_headers; 1121 } else {1122 if ( current_theme_supports( 'custom-header', 'random-default' ) )1123 $headers = $_wp_default_headers;1124 1121 } 1125 1122 } 1126 1123 … … 1128 1125 return new stdClass; 1129 1126 1130 1127 $_wp_random_header = (object) $headers[ array_rand( $headers ) ]; 1131 1132 $_wp_random_header->url = sprintf( $_wp_random_header->url, get_template_directory_uri(), get_stylesheet_directory_uri() );1133 $_wp_random_header->thumbnail_url = sprintf( $_wp_random_header->thumbnail_url, get_template_directory_uri(), get_stylesheet_directory_uri() );1134 1128 } 1135 1129 return $_wp_random_header; 1136 1130 } … … 1242 1236 } else { 1243 1237 $data = get_theme_mod( 'header_image_data' ); 1244 1238 if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) { 1245 $directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() );1246 1239 $data = array(); 1247 $data['url'] = $data['thumbnail_url'] = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args);1240 $data['url'] = $data['thumbnail_url'] = get_theme_support( 'custom-header', 'default-image' ); 1248 1241 if ( ! empty( $_wp_default_headers ) ) { 1249 1242 foreach ( (array) $_wp_default_headers as $default_header ) { 1250 $url = vsprintf( $default_header['url'], $directory_args ); 1251 if ( $data['url'] == $url ) { 1243 if ( $data['url'] == $default_header['url'] ) { 1252 1244 $data = $default_header; 1253 $data['url'] = $url;1254 $data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args );1255 1245 break; 1256 1246 } 1257 1247 } … … 1281 1271 function register_default_headers( $headers ) { 1282 1272 global $_wp_default_headers; 1283 1273 1274 $directories = array( get_template_directory_uri(), get_stylesheet_directory_uri() ); 1275 1276 foreach ( (array) $headers as $key => $header ) { 1277 if ( isset( $header['url'] ) ) { 1278 $headers[ $key ]['url'] = vsprintf( $header['url'], $directories ); 1279 } 1280 1281 if ( isset( $header['thumbnail_url'] ) ) { 1282 $headers[ $key ]['thumbnail_url'] = vsprintf( $header['thumbnail_url'], $directories ); 1283 } 1284 } 1285 1284 1286 $_wp_default_headers = array_merge( (array) $_wp_default_headers, (array) $headers ); 1285 1287 } 1286 1288 … … 2238 2240 case 'custom-logo' : 2239 2241 case 'custom-header' : 2240 2242 case 'custom-background' : 2241 if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) ) 2242 return $_wp_theme_features[ $feature ][0][ $args[0] ]; 2243 if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) ) { 2244 $value = $_wp_theme_features[ $feature ][0][ $args[0] ]; 2245 if ( 'default-image' === $args[0] ) { 2246 $value = sprintf( $value, get_template_directory_uri(), get_stylesheet_directory_uri() ); 2247 } 2248 return $value; 2249 } 2243 2250 return false; 2244 2251 2245 2252 default :