get_header_image(), 'thumbnail_url' => get_header_image(), 'width' => HEADER_IMAGE_WIDTH, 'height' => HEADER_IMAGE_HEIGHT ); } } /** * Setup the WordPress core custom header arguments and settings. * * Use add_theme_support() to register support for WordPress 3.4+ * as well as provide backward compatibility for previous versions. * * Use feature detection of wp_get_theme() which was introduced * in WordPress 3.4. * * @uses twentytwelve_header_style() * @uses twentytwelve_admin_header_style() * @uses twentytwelve_admin_header_image() * * @package Twenty_Twelve */ function twentytwelve_custom_header_setup() { $args = array( // Text color and image (empty to use none). 'default-text-color' => '444', 'default-image' => '', // Set height and width, with a maximum value for the width. 'height' => 250, 'width' => 960, 'max-width' => 2000, // Support flexible height and width. 'flex-height' => true, 'flex-width' => true, // Random image rotation off by default. 'random-default' => false, // Callbacks for styling the header and the admin preview. 'wp-head-callback' => 'twentytwelve_header_style', 'admin-head-callback' => 'twentytwelve_admin_header_style', 'admin-preview-callback' => 'twentytwelve_admin_header_image', ); // Allow child themes to filter any of these arguments. $args = apply_filters( 'twentytwelve_custom_header_args', $args ); if ( function_exists( 'wp_get_theme' ) ) { add_theme_support( 'custom-header', $args ); } else { // Back compat for < 3.4 versions. define( 'HEADER_TEXTCOLOR', $args['default-text-color'] ); define( 'HEADER_IMAGE', $args['default-image'] ); define( 'HEADER_IMAGE_WIDTH', $args['width'] ); define( 'HEADER_IMAGE_HEIGHT', $args['height'] ); add_custom_image_header( $args['wp-head-callback'], $args['admin-head-callback'], $args['admin-preview-callback'] ); } } add_action( 'after_setup_theme', 'twentytwelve_custom_header_setup' ); /** * Styles the header text displayed on the blog. * * get_header_textcolor() options: 444 is default, hide text (returns 'blank'), or any hex value. * * @since Twenty Twelve 1.0 */ function twentytwelve_header_style() { $text_color = get_header_textcolor(); // If no custom options for text are set, let's bail if ( $text_color == get_theme_support( 'custom-header', 'default-text-color' ) ) return; // If we get this far, we have custom styles. ?> Header admin panel. * * @since Twenty Twelve 1.0 */ function twentytwelve_admin_header_style() { ?> Header admin panel. * * @since Twenty Twelve 1.0 */ function twentytwelve_admin_header_image() { ?>