From 54822700b86c4c0d7e4865f1f1777db30fba739c Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 29 Apr 2011 19:45:30 +0000 Subject: [PATCH] Fix hiding of header image. Fix radio selection when falling back to randomized default headers. Props lancewillett, kawauso. see #17240 git-svn-id: https://develop.svn.wordpress.org/trunk@17770 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/custom-header.php | 6 +++--- wp-includes/theme.php | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index 7c739b0ff6..ff71046d74 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -193,7 +193,7 @@ class Custom_Image_Header { if ( isset( $_POST['removeheader'] ) ) { check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); - set_theme_mod( 'header_image', '' ); + set_theme_mod( 'header_image', 'remove-header' ); return; } @@ -546,7 +546,7 @@ class Custom_Image_Header { + if ( get_header_image() ) : ?> @@ -556,7 +556,7 @@ class Custom_Image_Header { + if ( defined( 'HEADER_IMAGE' ) && '' != HEADER_IMAGE ) : ?> diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 3704b3ce52..ea7d79d6f2 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1429,6 +1429,9 @@ function get_header_image() { $default = defined( 'HEADER_IMAGE' ) ? HEADER_IMAGE : ''; $url = get_theme_mod( 'header_image', $default ); + if ( 'remove-header' == $url ) + return false; + if ( is_random_header_image() ) $url = get_random_header_image(); @@ -1489,6 +1492,8 @@ function is_random_header_image( $type = 'any' ) { } else { if ( "random-$type-image" == $header_image_mod ) return true; + elseif ( 'default' == $type && empty( $header_image_mod ) && '' != get_random_header_image() ) + return true; } return false;