WordPress.org

Make WordPress Core

Changeset 21328


Ignore:
Timestamp:
07/25/12 17:12:40 (21 months ago)
Author:
lancewillett
Message:

Twenty Twelve: remove back compat for custom header image, installs prior to 3.4 will not see it as an option. Props obenland, closes #21231.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentytwelve/inc/custom-header.php

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