Make WordPress Core

Ticket #15926: 15926.patch

File 15926.patch, 1.9 KB (added by SergeyBiryukov, 14 years ago)
  • wp-admin/custom-header.php

     
    205205                        if ( isset($this->default_headers[$_POST['default-header']]) )
    206206                                set_theme_mod('header_image', esc_url($this->default_headers[$_POST['default-header']]['url']));
    207207                }
     208
     209                if ( isset( $_POST['alt-text'] ) ) {
     210                        check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
     211                        set_theme_mod( 'background_alt', esc_html( $_POST['alt-text'] ) );
     212                }
    208213        }
    209214
    210215        /**
     
    494499        ?>
    495500</td>
    496501</tr>
    497         <?php endif;
    498 
    499         if ( get_header_image() ) : ?>
     502        <?php endif; ?>
    500503<tr valign="top">
     504<th scope="row"><?php _e( 'Alternative Text' ); ?></th>
     505<td>
     506<fieldset>
     507        <legend class="screen-reader-text">
     508                <span><?php _e( 'Alternative Text' ); ?></span>
     509        </legend>
     510        <input type="text" name="alt-text" id="alt-text" value="<?php echo stripslashes( get_background_alt() ) ?>" />
     511</fieldset></td>
     512</tr>
     513        <?php if ( get_header_image() ) : ?>
     514<tr valign="top">
    501515<th scope="row"><?php _e( 'Remove Image' ); ?></th>
    502516<td>
    503517        <p><?php _e( 'This will remove the header image. You will not be able to restore any customizations.' ) ?></p>
  • wp-includes/theme.php

     
    15441544}
    15451545
    15461546/**
     1547 * Retrieve background image alt attribute for custom background.
     1548 *
     1549 * @uses BACKGROUND_ALT
     1550 *
     1551 * @return string
     1552 */
     1553function get_background_alt() {
     1554        $default = defined('BACKGROUND_ALT') ? BACKGROUND_ALT : '';
     1555
     1556        return get_theme_mod('background_alt', $default);
     1557}
     1558
     1559/**
     1560 * Display background image alt attribute.
     1561 *
     1562 *
     1563 */
     1564function background_alt() {
     1565        echo get_background_alt();
     1566}
     1567
     1568/**
    15471569 * Retrieve background image for custom background.
    15481570 *
    15491571 * @since 3.0.0