11 |
11 |
12 /** |
12 /** |
13 * Set up the WordPress core custom header arguments and settings. |
13 * Set up the WordPress core custom header arguments and settings. |
14 * |
14 * |
15 * @uses add_theme_support() to register support for 3.4 and up. |
15 * @uses add_theme_support() to register support for 3.4 and up. |
16 * @uses twentytwelve_header_style() to style front-end. |
16 * @uses twentytwelve_header_style() to style front end. |
17 * @uses twentytwelve_admin_header_style() to style wp-admin form. |
17 * @uses twentytwelve_admin_header_style() to style wp-admin form. |
18 * @uses twentytwelve_admin_header_image() to add custom markup to wp-admin form. |
18 * @uses twentytwelve_admin_header_image() to add custom markup to wp-admin form. |
19 * |
19 * |
20 * @since Twenty Twelve 1.0 |
20 * @since Twenty Twelve 1.0 |
21 */ |
21 */ |
52 * |
52 * |
53 * @since Twenty Twelve 1.2 |
53 * @since Twenty Twelve 1.2 |
54 */ |
54 */ |
55 function twentytwelve_custom_header_fonts() { |
55 function twentytwelve_custom_header_fonts() { |
56 $font_url = twentytwelve_get_font_url(); |
56 $font_url = twentytwelve_get_font_url(); |
57 if ( ! empty( $font_url ) ) |
57 if ( ! empty( $font_url ) ) { |
58 wp_enqueue_style( 'twentytwelve-fonts', esc_url_raw( $font_url ), array(), null ); |
58 wp_enqueue_style( 'twentytwelve-fonts', esc_url_raw( $font_url ), array(), null ); |
|
59 } |
59 } |
60 } |
60 add_action( 'admin_print_styles-appearance_page_custom-header', 'twentytwelve_custom_header_fonts' ); |
61 add_action( 'admin_print_styles-appearance_page_custom-header', 'twentytwelve_custom_header_fonts' ); |
61 |
62 |
62 /** |
63 /** |
63 * Style the header text displayed on the blog. |
64 * Style the header text displayed on the blog. |
68 */ |
69 */ |
69 function twentytwelve_header_style() { |
70 function twentytwelve_header_style() { |
70 $text_color = get_header_textcolor(); |
71 $text_color = get_header_textcolor(); |
71 |
72 |
72 // If no custom options for text are set, let's bail |
73 // If no custom options for text are set, let's bail |
73 if ( $text_color == get_theme_support( 'custom-header', 'default-text-color' ) ) |
74 if ( $text_color == get_theme_support( 'custom-header', 'default-text-color' ) ) { |
74 return; |
75 return; |
|
76 } |
75 |
77 |
76 // If we get this far, we have custom styles. |
78 // If we get this far, we have custom styles. |
77 ?> |
79 ?> |
78 <style type="text/css" id="twentytwelve-header-css"> |
80 <style type="text/css" id="twentytwelve-header-css"> |
79 <?php |
81 <?php |
80 // Has the text been hidden? |
82 // Has the text been hidden? |
81 if ( ! display_header_text() ) : |
83 if ( ! display_header_text() ) : |
82 ?> |
84 ?> |
83 .site-title, |
85 .site-title, |
84 .site-description { |
86 .site-description { |
85 position: absolute; |
87 position: absolute; |
86 clip: rect(1px 1px 1px 1px); /* IE7 */ |
88 clip: rect(1px 1px 1px 1px); /* IE7 */ |
87 clip: rect(1px, 1px, 1px, 1px); |
89 clip: rect(1px, 1px, 1px, 1px); |
88 } |
90 } |
89 <?php |
91 <?php |
90 // If the user has set a custom color for the text, use that. |
92 // If the user has set a custom color for the text, use that. |
91 else : |
93 else : |
92 ?> |
94 ?> |
93 .site-header h1 a, |
95 .site-header h1 a, |
94 .site-header h2 { |
96 .site-header h2 { |
95 color: #<?php echo $text_color; ?>; |
97 color: #<?php echo $text_color; ?>; |
153 } |
155 } |
154 ?> |
156 ?> |
155 <div id="headimg"> |
157 <div id="headimg"> |
156 <h1 class="displaying-header-text"><a id="name" style="<?php echo esc_attr( $style ); ?>" onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1> |
158 <h1 class="displaying-header-text"><a id="name" style="<?php echo esc_attr( $style ); ?>" onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1> |
157 <h2 id="desc" class="displaying-header-text" style="<?php echo esc_attr( $style ); ?>"><?php bloginfo( 'description' ); ?></h2> |
159 <h2 id="desc" class="displaying-header-text" style="<?php echo esc_attr( $style ); ?>"><?php bloginfo( 'description' ); ?></h2> |
158 <?php $header_image = get_header_image(); |
160 <?php |
159 if ( ! empty( $header_image ) ) : ?> |
161 $header_image = get_header_image(); |
|
162 if ( ! empty( $header_image ) ) : |
|
163 ?> |
160 <img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="" /> |
164 <img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="" /> |
161 <?php endif; ?> |
165 <?php endif; ?> |
162 </div> |
166 </div> |
163 <?php } |
167 <?php |
|
168 } |