wp/wp-content/themes/twentytwelve/inc/custom-header.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
     1 <?php
     1 <?php
     2 /**
     2 /**
     3  * Implement an optional custom header for Twenty Twelve
     3  * Implement an optional custom header for Twenty Twelve
     4  *
     4  *
     5  * See http://codex.wordpress.org/Custom_Headers
     5  * See https://codex.wordpress.org/Custom_Headers
     6  *
     6  *
     7  * @package WordPress
     7  * @package WordPress
     8  * @subpackage Twenty_Twelve
     8  * @subpackage Twenty_Twelve
     9  * @since Twenty Twelve 1.0
     9  * @since Twenty Twelve 1.0
    10  */
    10  */
    49 
    49 
    50 /**
    50 /**
    51  * Load our special font CSS file.
    51  * Load our special font CSS file.
    52  *
    52  *
    53  * @since Twenty Twelve 1.2
    53  * @since Twenty Twelve 1.2
    54  *
       
    55  * @return void
       
    56  */
    54  */
    57 function twentytwelve_custom_header_fonts() {
    55 function twentytwelve_custom_header_fonts() {
    58 	$font_url = twentytwelve_get_font_url();
    56 	$font_url = twentytwelve_get_font_url();
    59 	if ( ! empty( $font_url ) )
    57 	if ( ! empty( $font_url ) )
    60 		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 );
   147  * This callback overrides the default markup displayed there.
   145  * This callback overrides the default markup displayed there.
   148  *
   146  *
   149  * @since Twenty Twelve 1.0
   147  * @since Twenty Twelve 1.0
   150  */
   148  */
   151 function twentytwelve_admin_header_image() {
   149 function twentytwelve_admin_header_image() {
       
   150 	$style = 'color: #' . get_header_textcolor() . ';';
       
   151 	if ( ! display_header_text() ) {
       
   152 		$style = 'display: none;';
       
   153 	}
   152 	?>
   154 	?>
   153 	<div id="headimg">
   155 	<div id="headimg">
   154 		<?php
   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>
   155 		if ( ! display_header_text() )
   157 		<h2 id="desc" class="displaying-header-text" style="<?php echo esc_attr( $style ); ?>"><?php bloginfo( 'description' ); ?></h2>
   156 			$style = ' style="display:none;"';
       
   157 		else
       
   158 			$style = ' style="color:#' . get_header_textcolor() . ';"';
       
   159 		?>
       
   160 		<h1 class="displaying-header-text"><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
       
   161 		<h2 id="desc" class="displaying-header-text"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></h2>
       
   162 		<?php $header_image = get_header_image();
   158 		<?php $header_image = get_header_image();
   163 		if ( ! empty( $header_image ) ) : ?>
   159 		if ( ! empty( $header_image ) ) : ?>
   164 			<img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
   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="" />
   165 		<?php endif; ?>
   161 		<?php endif; ?>
   166 	</div>
   162 	</div>
   167 <?php }
   163 <?php }