- Timestamp:
- 08/14/2013 04:38:01 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfourteen/inc/custom-header.php
r24832 r25021 23 23 */ 24 24 function twentyfourteen_custom_header_setup() { 25 $args = array( 26 'default-image' => '', 25 add_theme_support( 'custom-header', apply_filters( 'twentyfourteen_custom_header_args', array( 27 26 'default-text-color' => 'fff', 28 27 'width' => 1260, … … 32 31 'admin-head-callback' => 'twentyfourteen_admin_header_style', 33 32 'admin-preview-callback' => 'twentyfourteen_admin_header_image', 34 ) ;33 ) ) ); 35 34 36 $args = apply_filters( 'twentyfourteen_custom_header_args', $args );37 38 if ( function_exists( 'wp_get_theme' ) ) {39 add_theme_support( 'custom-header', $args );40 } else {41 // Compat: Versions of WordPress prior to 3.4.42 define( 'HEADER_TEXTCOLOR', $args['default-text-color'] );43 define( 'HEADER_IMAGE', $args['default-image'] );44 define( 'HEADER_IMAGE_WIDTH', $args['width'] );45 define( 'HEADER_IMAGE_HEIGHT', $args['height'] );46 add_custom_image_header( $args['wp-head-callback'], $args['admin-head-callback'], $args['admin-preview-callback'] );47 }48 35 } 49 36 add_action( 'after_setup_theme', 'twentyfourteen_custom_header_setup' ); 50 51 /**52 * Shiv for get_custom_header().53 *54 * get_custom_header() was introduced to WordPress55 * in version 3.4. To provide backward compatibility56 * with previous versions, we will define our own version57 * of this function.58 *59 * @todo Remove this function when WordPress 3.6 is released.60 * @return stdClass All properties represent attributes of the curent header image.61 *62 * @package WordPress63 * @subpackage Twenty_Fourteen64 */65 66 if ( ! function_exists( 'get_custom_header' ) ) {67 function get_custom_header() {68 return (object) array(69 'url' => get_header_image(),70 'thumbnail_url' => get_header_image(),71 'width' => HEADER_IMAGE_WIDTH,72 'height' => HEADER_IMAGE_HEIGHT,73 );74 }75 }76 37 77 38 if ( ! function_exists( 'twentyfourteen_header_style' ) ) : … … 83 44 */ 84 45 function twentyfourteen_header_style() { 46 $header_text_color = get_header_textcolor(); 85 47 86 48 // If no custom options for text are set, let's bail 87 // get_header_textcolor()options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value88 if ( HEADER_TEXTCOLOR == get_header_textcolor())49 // $header_text_color options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value 50 if ( HEADER_TEXTCOLOR == $header_text_color ) 89 51 return; 90 52 // If we get this far, we have custom styles. Let's do this. … … 93 55 <?php 94 56 // Has the text been hidden? 95 if ( 'blank' == get_header_textcolor()) :57 if ( 'blank' == $header_text_color ) : 96 58 ?> 97 59 .site-title { … … 105 67 ?> 106 68 .site-title a { 107 color: #<?php echo get_header_textcolor(); ?> !important;69 color: #<?php echo $header_text_color; ?> !important; 108 70 } 109 71 <?php endif; ?> … … 154 116 * 155 117 */ 156 function twentyfourteen_admin_header_image() { ?> 118 function twentyfourteen_admin_header_image() { 119 $header_image = get_header_image(); 120 ?> 157 121 <div id="headimg"> 158 <?php 159 if ( 'blank' == get_header_textcolor() || '' == get_header_textcolor() ) 160 $style = ' style="display:none;"'; 161 else 162 $style = ' style="color:#' . get_header_textcolor() . ';"'; 163 ?> 164 <?php $header_image = get_header_image(); 165 if ( ! empty( $header_image ) ) : ?> 166 <img src="<?php echo esc_url( $header_image ); ?>" alt="" /> 122 <?php if ( ! empty( $header_image ) ) : ?> 123 <img src="<?php echo esc_url( $header_image ); ?>" alt=""> 167 124 <?php endif; ?> 168 <h1 ><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>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> 169 126 </div> 170 <?php } 127 <?php 128 } 171 129 endif; // twentyfourteen_admin_header_image
Note: See TracChangeset
for help on using the changeset viewer.