| 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 | | /** |
| 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 ) ); |