X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/baca9ce86a38dc54c4574890ee2d352fd81f78b2..61343b82c4f0da4c68e4c6373daafff4a81efdd1:/wp-content/themes/twentythirteen/inc/custom-header.php diff --git a/wp-content/themes/twentythirteen/inc/custom-header.php b/wp-content/themes/twentythirteen/inc/custom-header.php new file mode 100644 index 00000000..a835061f --- /dev/null +++ b/wp-content/themes/twentythirteen/inc/custom-header.php @@ -0,0 +1,215 @@ + '220e10', + 'default-image' => '%s/images/headers/circle.png', + + // Set height and width, with a maximum value for the width. + 'height' => 230, + 'width' => 1600, + + // Callbacks for styling the header and the admin preview. + 'wp-head-callback' => 'twentythirteen_header_style', + 'admin-head-callback' => 'twentythirteen_admin_header_style', + 'admin-preview-callback' => 'twentythirteen_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. + */ + register_default_headers( array( + 'circle' => array( + 'url' => '%s/images/headers/circle.png', + 'thumbnail_url' => '%s/images/headers/circle-thumbnail.png', + 'description' => _x( 'Circle', 'header image description', 'twentythirteen' ) + ), + 'diamond' => array( + 'url' => '%s/images/headers/diamond.png', + 'thumbnail_url' => '%s/images/headers/diamond-thumbnail.png', + 'description' => _x( 'Diamond', 'header image description', 'twentythirteen' ) + ), + 'star' => array( + 'url' => '%s/images/headers/star.png', + 'thumbnail_url' => '%s/images/headers/star-thumbnail.png', + 'description' => _x( 'Star', 'header image description', 'twentythirteen' ) + ), + ) ); +} +add_action( 'after_setup_theme', 'twentythirteen_custom_header_setup' ); + +/** + * Loads our special font CSS files. + * + * @since Twenty Thirteen 1.0 + */ +function twentythirteen_custom_header_fonts() { + // Add Open Sans and Bitter fonts. + wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null ); + + // Add Genericons font. + wp_enqueue_style( 'genericons', get_template_directory_uri() . '/fonts/genericons.css', array(), '2.09' ); +} +add_action( 'admin_print_styles-appearance_page_custom-header', 'twentythirteen_custom_header_fonts' ); + +/** + * Styles the header text displayed on the blog. + * + * get_header_textcolor() options: Hide text (returns 'blank'), or any hex value. + * + * @since Twenty Thirteen 1.0 + */ +function twentythirteen_header_style() { + $header_image = get_header_image(); + $text_color = get_header_textcolor(); + + // If no custom options for text are set, let's bail. + if ( empty( $header_image ) && $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 Thirteen 1.0 + */ +function twentythirteen_admin_header_style() { + $header_image = get_header_image(); +?> + + Header admin panel. + * This callback overrides the default markup displayed there. + * + * @since Twenty Thirteen 1.0 + */ +function twentythirteen_admin_header_image() { + ?> +
+ + +
+