Make WordPress Core

Ticket #25540: 25540.1.diff

File 25540.1.diff, 3.6 KB (added by obenland, 11 years ago)
  • wp-content/themes/twentyfourteen/inc/custom-header.php

     
    77/**
    88 * Setup the WordPress core custom header feature.
    99 *
    10  * Use add_theme_support to register support for WordPress 3.4+
    11  * as well as provide backward compatibility for previous versions.
    12  * Use feature detection of wp_get_theme() which was introduced
    13  * in WordPress 3.4.
    14  *
    15  * @todo Rework this function to remove WordPress 3.4 support when WordPress 3.6 is released.
    16  *
    1710 * @uses twentyfourteen_header_style()
    1811 * @uses twentyfourteen_admin_header_style()
    1912 * @uses twentyfourteen_admin_header_image()
    20  *
    21  * @package WordPress
    22  * @subpackage Twenty_Fourteen
    2313 */
    2414function twentyfourteen_custom_header_setup() {
    2515        add_theme_support( 'custom-header', apply_filters( 'twentyfourteen_custom_header_args', array(
    26                 'default-text-color'     => 'fff',
     16                'header-text'            => false,
    2717                'width'                  => 1260,
    2818                'height'                 => 240,
    2919                'flex-height'            => true,
    30                 'wp-head-callback'       => 'twentyfourteen_header_style',
    3120                'admin-head-callback'    => 'twentyfourteen_admin_header_style',
    3221                'admin-preview-callback' => 'twentyfourteen_admin_header_image',
    3322        ) ) );
    34 
    3523}
    3624add_action( 'after_setup_theme', 'twentyfourteen_custom_header_setup' );
    3725
    38 if ( ! function_exists( 'twentyfourteen_header_style' ) ) :
    39 /**
    40  * Styles the header image and text displayed on the blog
    41  *
    42  * @see twentyfourteen_custom_header_setup().
    43  *
    44  */
    45 function twentyfourteen_header_style() {
    46         $header_text_color = get_header_textcolor();
    47 
    48         // If no custom options for text are set, let's bail
    49         // $header_text_color options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value
    50         if ( HEADER_TEXTCOLOR == $header_text_color )
    51                 return;
    52         // If we get this far, we have custom styles. Let's do this.
    53         ?>
    54         <style type="text/css">
    55         <?php
    56                 // Has the text been hidden?
    57                 if ( 'blank' == $header_text_color ) :
    58         ?>
    59                 .site-title {
    60                         position: absolute !important;
    61                         clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
    62                         clip: rect(1px, 1px, 1px, 1px);
    63                 }
    64         <?php
    65                 // If the user has set a custom color for the text use that
    66                 else :
    67         ?>
    68                 .site-title a {
    69                         color: #<?php echo $header_text_color; ?> !important;
    70                 }
    71         <?php endif; ?>
    72         </style>
    73         <?php
    74 }
    75 endif; // twentyfourteen_header_style
    76 
    7726if ( ! function_exists( 'twentyfourteen_admin_header_style' ) ) :
    7827/**
    7928 * Styles the header image displayed on the Appearance > Header admin panel.
    8029 *
    8130 * @see twentyfourteen_custom_header_setup().
    82  *
    8331 */
    8432function twentyfourteen_admin_header_style() {
    8533?>
     
    11361 * Custom header image markup displayed on the Appearance > Header admin panel.
    11462 *
    11563 * @see twentyfourteen_custom_header_setup().
    116  *
    11764 */
    11865function twentyfourteen_admin_header_image() {
    119         $header_image = get_header_image();
    12066?>
    12167        <div id="headimg">
    122                 <?php if ( ! empty( $header_image ) ) : ?>
    123                 <img src="<?php echo esc_url( $header_image ); ?>" alt="">
     68                <?php if ( get_header_image() ) : ?>
     69                <img src="<?php header_image(); ?>" alt="">
    12470                <?php endif; ?>
    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>
     71                <h1><a id="name" onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
    12672        </div>
    12773<?php
    12874}