Changeset 25765
- Timestamp:
- 10/11/2013 05:13:27 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfourteen/inc/custom-header.php
r25749 r25765 8 8 * Setup the WordPress core custom header feature. 9 9 * 10 * Use add_theme_support to register support for WordPress 3.4+11 * as well as provide backward compatibility for previous versions.12 * Use feature detection of wp_get_theme() which was introduced13 * in WordPress 3.4.14 *15 * @todo Rework this function to remove WordPress 3.4 support when WordPress 3.6 is released.16 *17 10 * @uses twentyfourteen_header_style() 18 11 * @uses twentyfourteen_admin_header_style() 19 12 * @uses twentyfourteen_admin_header_image() 20 *21 * @package WordPress22 * @subpackage Twenty_Fourteen23 13 */ 24 14 function twentyfourteen_custom_header_setup() { 25 15 add_theme_support( 'custom-header', apply_filters( 'twentyfourteen_custom_header_args', array( 26 ' default-text-color' => 'fff',16 'header-text' => false, 27 17 'width' => 1260, 28 18 'height' => 240, 29 19 'flex-height' => true, 30 'wp-head-callback' => 'twentyfourteen_header_style',31 20 'admin-head-callback' => 'twentyfourteen_admin_header_style', 32 21 'admin-preview-callback' => 'twentyfourteen_admin_header_image', 33 22 ) ) ); 34 35 23 } 36 24 add_action( 'after_setup_theme', 'twentyfourteen_custom_header_setup' ); 37 38 if ( ! function_exists( 'twentyfourteen_header_style' ) ) :39 /**40 * Styles the header image and text displayed on the blog41 *42 * @see twentyfourteen_custom_header_setup().43 *44 */45 function twentyfourteen_header_style() {46 $header_text_color = get_header_textcolor();47 48 // If no custom options for text are set, let's bail49 // $header_text_color options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value50 if ( HEADER_TEXTCOLOR == $header_text_color )51 return;52 // If we get this far, we have custom styles. Let's do this.53 ?>54 <style type="text/css">55 <?php56 // Has the text been hidden?57 if ( 'blank' == $header_text_color ) :58 ?>59 .site-title {60 position: absolute !important;61 clip: rect(1px 1px 1px 1px); /* IE6, IE7 */62 clip: rect(1px, 1px, 1px, 1px);63 }64 <?php65 // If the user has set a custom color for the text use that66 else :67 ?>68 .site-title a {69 color: #<?php echo $header_text_color; ?> !important;70 }71 <?php endif; ?>72 </style>73 <?php74 }75 endif; // twentyfourteen_header_style76 25 77 26 if ( ! function_exists( 'twentyfourteen_admin_header_style' ) ) : … … 80 29 * 81 30 * @see twentyfourteen_custom_header_setup(). 82 *83 31 */ 84 32 function twentyfourteen_admin_header_style() { … … 114 62 * 115 63 * @see twentyfourteen_custom_header_setup(). 116 *117 64 */ 118 65 function twentyfourteen_admin_header_image() { 119 $header_image = get_header_image();120 66 ?> 121 67 <div id="headimg"> 122 <?php if ( ! empty( $header_image) ) : ?>123 <img src="<?php echo esc_url( $header_image); ?>" alt="">68 <?php if ( get_header_image() ) : ?> 69 <img src="<?php header_image(); ?>" alt=""> 124 70 <?php endif; ?> 125 <h1 class="displaying-header-text"><a id="name"<?php echo sprintf( ' style="color:#%s;"', get_header_textcolor() ); ?>onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>71 <h1><a id="name" onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1> 126 72 </div> 127 73 <?php
Note: See TracChangeset
for help on using the changeset viewer.