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
This commit is contained in:
Ryan Boren 2011-04-29 19:45:30 +00:00
parent f1747e6f35
commit 54822700b8
2 changed files with 8 additions and 3 deletions

View File

@ -193,7 +193,7 @@ class Custom_Image_Header {
if ( isset( $_POST['removeheader'] ) ) { if ( isset( $_POST['removeheader'] ) ) {
check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' ); check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
set_theme_mod( 'header_image', '' ); set_theme_mod( 'header_image', 'remove-header' );
return; return;
} }
@ -546,7 +546,7 @@ class Custom_Image_Header {
</td> </td>
</tr> </tr>
<?php endif; <?php endif;
if ( get_header_image() && !is_random_header_image() ) : ?> if ( get_header_image() ) : ?>
<tr valign="top"> <tr valign="top">
<th scope="row"><?php _e( 'Remove Image' ); ?></th> <th scope="row"><?php _e( 'Remove Image' ); ?></th>
<td> <td>
@ -556,7 +556,7 @@ class Custom_Image_Header {
</tr> </tr>
<?php endif; <?php endif;
if ( defined( 'HEADER_IMAGE' ) && !is_random_header_image() ) : ?> if ( defined( 'HEADER_IMAGE' ) && '' != HEADER_IMAGE ) : ?>
<tr valign="top"> <tr valign="top">
<th scope="row"><?php _e( 'Reset Image' ); ?></th> <th scope="row"><?php _e( 'Reset Image' ); ?></th>
<td> <td>

View File

@ -1429,6 +1429,9 @@ function get_header_image() {
$default = defined( 'HEADER_IMAGE' ) ? HEADER_IMAGE : ''; $default = defined( 'HEADER_IMAGE' ) ? HEADER_IMAGE : '';
$url = get_theme_mod( 'header_image', $default ); $url = get_theme_mod( 'header_image', $default );
if ( 'remove-header' == $url )
return false;
if ( is_random_header_image() ) if ( is_random_header_image() )
$url = get_random_header_image(); $url = get_random_header_image();
@ -1489,6 +1492,8 @@ function is_random_header_image( $type = 'any' ) {
} else { } else {
if ( "random-$type-image" == $header_image_mod ) if ( "random-$type-image" == $header_image_mod )
return true; return true;
elseif ( 'default' == $type && empty( $header_image_mod ) && '' != get_random_header_image() )
return true;
} }
return false; return false;