mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-12 13:44:21 +01:00
Allow get_custom_header() to handle a default registered header that has yet to be saved to the database. fixes #22221.
git-svn-id: http://core.svn.wordpress.org/trunk@22436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a73aa40cb5
commit
e1f25c2c0e
@ -1025,7 +1025,27 @@ function get_uploaded_header_images() {
|
||||
* @return object
|
||||
*/
|
||||
function get_custom_header() {
|
||||
$data = is_random_header_image()? _get_random_header_data() : get_theme_mod( 'header_image_data' );
|
||||
global $_wp_default_headers;
|
||||
|
||||
if ( is_random_header_image() ) {
|
||||
$data = _get_random_header_data();
|
||||
} else {
|
||||
$data = get_theme_mod( 'header_image_data' );
|
||||
if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) {
|
||||
$directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() );
|
||||
$default_image = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args );
|
||||
foreach ( $_wp_default_headers as $header => $details ) {
|
||||
$url = vsprintf( $details['url'], $directory_args );
|
||||
if ( $default_image == $url ) {
|
||||
$data = $details;
|
||||
$data['url'] = $url;
|
||||
$data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$default = array(
|
||||
'url' => '',
|
||||
'thumbnail_url' => '',
|
||||
|
Loading…
Reference in New Issue
Block a user