WordPress.org

Make WordPress Core

Ticket #17240: 17240-random-input-fix.diff

File 17240-random-input-fix.diff, 3.5 KB (added by lancewillett, 4 years ago)
  • wp-admin/custom-header.php

     
    257257         * @since 3.0.0 
    258258         */ 
    259259        function show_header_selector( $type = 'default' ) { 
    260                 echo '<div id="available-headers">'; 
    261260                if ( 'default' == $type ) { 
    262261                        $headers = $this->default_headers; 
    263262                } else { 
     
    265264                        $type = 'uploaded'; 
    266265                } 
    267266 
     267                if ( 1 < count( $headers ) ) { 
     268                        echo '<div class="random-header">'; 
     269                        echo '<label><input name="default-header" type="radio" value="random-' . $type . '-image"' . checked( is_random_header_image( $type ), true, false ) . ' />'; 
     270                        echo __( '<strong>Random:</strong> Show a different image on each page.' ); 
     271                        echo '</label>'; 
     272                        echo '</div>'; 
     273                } 
     274 
     275                echo '<div class="available-headers">'; 
    268276                foreach ( $headers as $header_key => $header ) { 
    269277                        $header_thumbnail = $header['thumbnail_url']; 
    270278                        $header_url = $header['url']; 
     
    277285                        echo '<img src="' . $header_thumbnail . '" alt="' . esc_attr( $header_desc ) .'" title="' . esc_attr( $header_desc ) . '"' . $width . ' /></label>'; 
    278286                        echo '</div>'; 
    279287                } 
    280                 if ( 1 < count( $headers ) ) { 
    281                         echo '<div class="default-header">'; 
    282                         echo '<label><input name="default-header" type="radio" value="random-' . $type . '-image"' . checked( is_random_header_image( $type ), true, false ) . ' />'; 
    283                         echo __( '<strong>Random:</strong> Show a different image on each page.' ); 
    284                         echo '</label>'; 
    285                         echo '</div>'; 
    286                 } 
    287288                echo '<div class="clear"></div></div>'; 
    288289        } 
    289290 
     
    524525<tr valign="top"> 
    525526<th scope="row"><?php _e( 'Uploaded Images' ); ?></th> 
    526527<td> 
    527         <p><?php _e( 'You can use one of your previously uploaded headers.' ) ?></p> 
     528        <p><?php _e( 'You can choose one of your previously uploaded headers, or show a random one.' ) ?></p> 
    528529        <?php 
    529530                $this->show_header_selector( 'uploaded' ); 
    530531        ?> 
     
    536537<th scope="row"><?php _e( 'Default Images' ); ?></th> 
    537538<td> 
    538539<?php if ( current_theme_supports( 'custom-header-uploads' ) ) : ?> 
    539         <p><?php _e( 'If you don&lsquo;t want to upload your own image, you can use one of these cool headers.' ) ?></p> 
     540        <p><?php _e( 'If you don&lsquo;t want to upload your own image, you can use one of these cool headers, or show a random one.' ) ?></p> 
    540541<?php else: ?> 
    541         <p><?php _e( 'You can use one of these cool headers.' ) ?> 
     542        <p><?php _e( 'You can use one of these cool headers or show a random one on each page.' ) ?></p> 
    542543<?php endif; ?> 
    543544        <?php 
    544545                $this->show_header_selector( 'default' ); 
  • wp-admin/css/wp-admin.dev.css

     
    38783878        font-size: 11px; 
    38793879} 
    38803880 
    3881 .appearance_page_custom-header  #available-headers .default-header { 
     3881.appearance_page_custom-header .available-headers .default-header { 
    38823882        float: left; 
    38833883        margin: 0 20px 20px 0; 
    38843884} 
    38853885 
    3886 .appearance_page_custom-header #available-headers label input { 
     3886.appearance_page_custom-header .random-header { 
     3887        clear: both; 
     3888        margin: 0 20px 20px 0; 
     3889        vertical-align: middle; 
     3890} 
     3891 
     3892.appearance_page_custom-header .available-headers label input, 
     3893.appearance_page_custom-header .random-header label input { 
    38873894        margin-right: 10px; 
    38883895} 
    38893896 
    3890 .appearance_page_custom-header #available-headers label img { 
     3897.appearance_page_custom-header .available-headers label img { 
    38913898        vertical-align: middle; 
    38923899} 
    38933900