wp/wp-content/themes/twentythirteen/inc/custom-header.php
changeset 10 372f2766ea20
parent 7 cf61fcea0001
equal deleted inserted replaced
9:177826044cd9 10:372f2766ea20
    72 function twentythirteen_custom_header_fonts() {
    72 function twentythirteen_custom_header_fonts() {
    73 	// Add Source Sans Pro and Bitter fonts.
    73 	// Add Source Sans Pro and Bitter fonts.
    74 	wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );
    74 	wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );
    75 
    75 
    76 	// Add Genericons font.
    76 	// Add Genericons font.
    77 	wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.03' );
    77 	wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' );
    78 }
    78 }
    79 add_action( 'admin_print_styles-appearance_page_custom-header', 'twentythirteen_custom_header_fonts' );
    79 add_action( 'admin_print_styles-appearance_page_custom-header', 'twentythirteen_custom_header_fonts' );
    80 
    80 
    81 /**
    81 /**
    82  * Style the header text displayed on the blog.
    82  * Style the header text displayed on the blog.
    97 	// If we get this far, we have custom styles.
    97 	// If we get this far, we have custom styles.
    98 	?>
    98 	?>
    99 	<style type="text/css" id="twentythirteen-header-css">
    99 	<style type="text/css" id="twentythirteen-header-css">
   100 	<?php
   100 	<?php
   101 	if ( ! empty( $header_image ) ) :
   101 	if ( ! empty( $header_image ) ) :
   102 	?>
   102 		?>
   103 	.site-header {
   103 	.site-header {
   104 		background: url(<?php header_image(); ?>) no-repeat scroll top;
   104 		background: url(<?php header_image(); ?>) no-repeat scroll top;
   105 		background-size: 1600px auto;
   105 		background-size: 1600px auto;
   106 	}
   106 	}
   107 	@media (max-width: 767px) {
   107 	@media (max-width: 767px) {
   112 	@media (max-width: 359px) {
   112 	@media (max-width: 359px) {
   113 		.site-header {
   113 		.site-header {
   114 			background-size: 360px auto;
   114 			background-size: 360px auto;
   115 		}
   115 		}
   116 	}
   116 	}
   117 	<?php
   117 		<?php
   118 		endif;
   118 		endif;
   119 
   119 
   120 		// Has the text been hidden?
   120 		// Has the text been hidden?
   121 	if ( ! display_header_text() ) :
   121 	if ( ! display_header_text() ) :
   122 	?>
   122 		?>
   123 	.site-title,
   123 	.site-title,
   124 	.site-description {
   124 	.site-description {
   125 		position: absolute;
   125 		position: absolute;
   126 		clip: rect(1px 1px 1px 1px); /* IE7 */
   126 		clip: rect(1px 1px 1px 1px); /* IE7 */
   127 		clip: rect(1px, 1px, 1px, 1px);
   127 		clip: rect(1px, 1px, 1px, 1px);
   128 	}
   128 	}
   129 	<?php
   129 		<?php
   130 	if ( empty( $header_image ) ) :
   130 		if ( empty( $header_image ) ) :
   131 	?>
   131 			?>
   132 	.site-header .home-link {
   132 	.site-header .home-link {
   133 	min-height: 0;
   133 	min-height: 0;
   134 	}
   134 	}
   135 	<?php
   135 			<?php
   136 		endif;
   136 		endif;
   137 
   137 
   138 		// If the user has set a custom color for the text, use that.
   138 		// If the user has set a custom color for the text, use that.
   139 		elseif ( $text_color != get_theme_support( 'custom-header', 'default-text-color' ) ) :
   139 		elseif ( $text_color != get_theme_support( 'custom-header', 'default-text-color' ) ) :
   140 	?>
   140 			?>
   141 		.site-title,
   141 		.site-title,
   142 		.site-description {
   142 		.site-description {
   143 			color: #<?php echo esc_attr( $text_color ); ?>;
   143 			color: #<?php echo esc_attr( $text_color ); ?>;
   144 		}
   144 		}
   145 	<?php endif; ?>
   145 	<?php endif; ?>
   152  *
   152  *
   153  * @since Twenty Thirteen 1.0
   153  * @since Twenty Thirteen 1.0
   154  */
   154  */
   155 function twentythirteen_admin_header_style() {
   155 function twentythirteen_admin_header_style() {
   156 	$header_image = get_header_image();
   156 	$header_image = get_header_image();
   157 ?>
   157 	?>
   158 	<style type="text/css" id="twentythirteen-admin-header-css">
   158 	<style type="text/css" id="twentythirteen-admin-header-css">
   159 	.appearance_page_custom-header #headimg {
   159 	.appearance_page_custom-header #headimg {
   160 		border: none;
   160 		border: none;
   161 		-webkit-box-sizing: border-box;
   161 		-webkit-box-sizing: border-box;
   162 		-moz-box-sizing:    border-box;
   162 		-moz-box-sizing:    border-box;
   208 	.default-header img {
   208 	.default-header img {
   209 		max-width: 230px;
   209 		max-width: 230px;
   210 		width: auto;
   210 		width: auto;
   211 	}
   211 	}
   212 	</style>
   212 	</style>
   213 <?php
   213 	<?php
   214 }
   214 }
   215 
   215 
   216 /**
   216 /**
   217  * Output markup to be displayed on the Appearance > Header admin panel.
   217  * Output markup to be displayed on the Appearance > Header admin panel.
   218  *
   218  *
   230 		<div class="home-link">
   230 		<div class="home-link">
   231 			<h1 class="displaying-header-text"><a id="name" style="<?php echo esc_attr( $style ); ?>" onclick="return false;" href="#" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
   231 			<h1 class="displaying-header-text"><a id="name" style="<?php echo esc_attr( $style ); ?>" onclick="return false;" href="#" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
   232 			<h2 id="desc" class="displaying-header-text" style="<?php echo esc_attr( $style ); ?>"><?php bloginfo( 'description' ); ?></h2>
   232 			<h2 id="desc" class="displaying-header-text" style="<?php echo esc_attr( $style ); ?>"><?php bloginfo( 'description' ); ?></h2>
   233 		</div>
   233 		</div>
   234 	</div>
   234 	</div>
   235 <?php
   235 	<?php
   236 }
   236 }