- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfifteen/inc/custom-header.php
r33092 r42343 14 14 */ 15 15 function twentyfifteen_custom_header_setup() { 16 $color_scheme = twentyfifteen_get_color_scheme();17 $default_text_color = trim( $color_scheme[4], '#' );16 $color_scheme = twentyfifteen_get_color_scheme(); 17 $default_text_color = trim( $color_scheme[4], '#' ); 18 18 19 19 /** … … 32 32 * } 33 33 */ 34 add_theme_support( 'custom-header', apply_filters( 'twentyfifteen_custom_header_args', array( 35 'default-text-color' => $default_text_color, 36 'width' => 954, 37 'height' => 1300, 38 'wp-head-callback' => 'twentyfifteen_header_style', 39 ) ) ); 34 add_theme_support( 35 'custom-header', apply_filters( 36 'twentyfifteen_custom_header_args', array( 37 'default-text-color' => $default_text_color, 38 'width' => 954, 39 'height' => 1300, 40 'wp-head-callback' => 'twentyfifteen_header_style', 41 ) 42 ) 43 ); 40 44 } 41 45 add_action( 'after_setup_theme', 'twentyfifteen_custom_header_setup' ); … … 54 58 55 59 if ( strlen( $color ) == 3 ) { 56 $r = hexdec( substr( $color, 0, 1 ) .substr( $color, 0, 1 ) );57 $g = hexdec( substr( $color, 1, 1 ) .substr( $color, 1, 1 ) );58 $b = hexdec( substr( $color, 2, 1 ) .substr( $color, 2, 1 ) );59 } else if ( strlen( $color ) == 6 ) {60 $r = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) ); 61 $g = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) ); 62 $b = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) ); 63 } elseif ( strlen( $color ) == 6 ) { 60 64 $r = hexdec( substr( $color, 0, 2 ) ); 61 65 $g = hexdec( substr( $color, 2, 2 ) ); … … 65 69 } 66 70 67 return array( 'red' => $r, 'green' => $g, 'blue' => $b ); 71 return array( 72 'red' => $r, 73 'green' => $g, 74 'blue' => $b, 75 ); 68 76 } 69 77 70 78 if ( ! function_exists( 'twentyfifteen_header_style' ) ) : 71 /**72 * Styles the header image and text displayed on the blog.73 *74 * @since Twenty Fifteen 1.075 *76 * @see twentyfifteen_custom_header_setup()77 */78 function twentyfifteen_header_style() {79 $header_image = get_header_image();80 81 // If no custom options for text are set, let's bail.82 if ( empty( $header_image ) && display_header_text() ) {83 return;84 }85 86 // If we get this far, we have custom styles. Let's do this.87 ?>88 <style type="text/css" id="twentyfifteen-header-css">89 <?php79 /** 80 * Styles the header image and text displayed on the blog. 81 * 82 * @since Twenty Fifteen 1.0 83 * 84 * @see twentyfifteen_custom_header_setup() 85 */ 86 function twentyfifteen_header_style() { 87 $header_image = get_header_image(); 88 89 // If no custom options for text are set, let's bail. 90 if ( empty( $header_image ) && display_header_text() ) { 91 return; 92 } 93 94 // If we get this far, we have custom styles. Let's do this. 95 ?> 96 <style type="text/css" id="twentyfifteen-header-css"> 97 <?php 90 98 // Short header for when there is no Custom Header and Header Text is hidden. 91 99 if ( empty( $header_image ) && ! display_header_text() ) : … … 183 191 </style> 184 192 <?php 185 }193 } 186 194 endif; // twentyfifteen_header_style 187 195
Note: See TracChangeset
for help on using the changeset viewer.