Fix hiding of header image. Fix radio selection when falling back to randomized default headers. Props lancewillett, kawauso. see #17240
git-svn-id: http://svn.automattic.com/wordpress/trunk@17770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b59bcc8720
commit
e0ffff9fb5
|
@ -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 {
|
|||
</td>
|
||||
</tr>
|
||||
<?php endif;
|
||||
if ( get_header_image() && !is_random_header_image() ) : ?>
|
||||
if ( get_header_image() ) : ?>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e( 'Remove Image' ); ?></th>
|
||||
<td>
|
||||
|
@ -556,7 +556,7 @@ class Custom_Image_Header {
|
|||
</tr>
|
||||
<?php endif;
|
||||
|
||||
if ( defined( 'HEADER_IMAGE' ) && !is_random_header_image() ) : ?>
|
||||
if ( defined( 'HEADER_IMAGE' ) && '' != HEADER_IMAGE ) : ?>
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e( 'Reset Image' ); ?></th>
|
||||
<td>
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue