WordPress.org

Make WordPress Core

Ticket #21231: 21231.diff

File 21231.diff, 2.9 KB (added by obenland, 6 years ago)
  • wp-content/themes/twentytwelve/inc/custom-header.php

     
    88 */
    99
    1010/**
    11  * Back compat support for get_custom_header().
    12  * New since WordPress version 3.4.
    13  *
    14  * To provide backward compatibility with previous versions, we
    15  * will define our own version of this function.
    16  *
    17  * @todo Should this go into core instead?
    18  *
    19  * @return stdClass All properties represent attributes of the current header image.
    20  *
    21  * @package Twenty_Twelve
    22  * @since Twenty Twelve 1.0
    23  */
    24 if ( ! function_exists( 'get_custom_header' ) ) {
    25         function get_custom_header() {
    26                 return (object) array(
    27                         'url'           => get_header_image(),
    28                         'thumbnail_url' => get_header_image(),
    29                         'width'         => HEADER_IMAGE_WIDTH,
    30                         'height'        => HEADER_IMAGE_HEIGHT
    31                 );
    32         }
    33 }
    34 
    35 /**
    3611 * Setup the WordPress core custom header arguments and settings.
    3712 *
    3813 * Use add_theme_support() to register support for WordPress 3.4+
    39  * as well as provide backward compatibility for previous versions.
    40  *
    41  * Use feature detection of wp_get_theme() which was introduced
    42  * in WordPress 3.4.
    4314 *
    4415 * @uses twentytwelve_header_style()
    4516 * @uses twentytwelve_admin_header_style()
     
    7243        );
    7344
    7445        // Allow child themes to filter any of these arguments.
    75         $args = apply_filters( 'twentytwelve_custom_header_args', $args );
    76 
    77         if ( function_exists( 'wp_get_theme' ) ) {
    78                 add_theme_support( 'custom-header', $args );
    79         } else {
    80                 // Back compat for < 3.4 versions.
    81                 define( 'HEADER_TEXTCOLOR',    $args['default-text-color'] );
    82                 define( 'HEADER_IMAGE',        $args['default-image'] );
    83                 define( 'HEADER_IMAGE_WIDTH',  $args['width'] );
    84                 define( 'HEADER_IMAGE_HEIGHT', $args['height'] );
    85                 add_custom_image_header( $args['wp-head-callback'], $args['admin-head-callback'], $args['admin-preview-callback'] );
    86         }
     46        add_theme_support( 'custom-header', apply_filters( 'twentytwelve_custom_header_args', $args ) );
    8747}
    8848add_action( 'after_setup_theme', 'twentytwelve_custom_header_setup' );
    8949
  • wp-content/themes/twentytwelve/inc/theme-options.php

     
    122122                ?>
    123123                <div class="wrap">
    124124                        <?php screen_icon(); ?>
    125                         <?php $theme_name = function_exists( 'wp_get_theme' ) ? wp_get_theme() : get_current_theme(); ?>
    126                         <h2><?php printf( __( '%s Theme Options', 'twentytwelve' ), $theme_name ); ?></h2>
     125                        <h2><?php printf( __( '%s Theme Options', 'twentytwelve' ), wp_get_theme() ); ?></h2>
    127126                        <?php settings_errors(); ?>
    128127
    129128                        <form method="post" action="options.php">