'515151', 'default-image' => '%2$s/images/headers/TinyForge-header.jpg', // Set height and width, with a maximum value for the width. 'height' => 350, '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' => 'tinyforge_header_style', 'admin-head-callback' => 'tinyforge_admin_header_style', 'admin-preview-callback' => 'tinyforge_admin_header_image', ); add_theme_support( 'custom-header', $args ); /** * Default custom headers packaged with the theme. * %s is a placeholder for the theme template directory URI. * %2$s is a placeholder for the (child) theme stylesheet directory URI. * I'm using %2$s to make it easy for the user to replace default header images in a child theme. * @link http://codex.wordpress.org/Function_Reference/register_default_headers */ register_default_headers( array( 'First' => array( 'url' => '%2$s/images/headers/TinyForge-header.jpg', 'thumbnail_url' => '%2$s/images/headers/TinyForge-header-thumbnail.jpg', 'description' => _x( 'First', 'header image description', 'tinyforge' ) ), 'Second' => array( 'url' => '%2$s/images/headers/TinyForge-header-02.jpg', 'thumbnail_url' => '%2$s/images/headers/TinyForge-header-02-thumbnail.jpg', 'description' => _x( 'Second', 'header image description', 'tinyforge' ) ), 'Third' => array( 'url' => '%2$s/images/headers/TinyForge-header-03.jpg', 'thumbnail_url' => '%2$s/images/headers/TinyForge-header-03-thumbnail.jpg', 'description' => _x( 'Third', 'header image description', 'tinyforge' ) ), ) ); } add_action( 'after_setup_theme', 'tinyforge_custom_header_setup' ); /** * Load our special font CSS file. * * @since Tiny Forge 1.2 */ function tinyforge_custom_header_fonts() { $font_url = tinyforge_get_font_url(); if ( ! empty( $font_url ) ) wp_enqueue_style( 'tinyforge-fonts', esc_url_raw( $font_url ), array(), null ); } add_action( 'admin_print_styles-appearance_page_custom-header', 'tinyforge_custom_header_fonts' ); /** * Style the header text displayed on the blog. * * get_header_textcolor() options: 515151 is default, hide text (returns 'blank'), or any hex value. * * @since Tiny Forge 1.0 */ function tinyforge_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 Tiny Forge 1.0 */ function tinyforge_admin_header_style() { ?> Header admin panel. * This callback overrides the default markup displayed there. * * @since Tiny Forge 1.0 */ function tinyforge_admin_header_image() { $style = 'color: #' . get_header_textcolor() . ';'; if ( ! display_header_text() ) { $style = 'display: none;'; } ?>