WordPress.org

Make WordPress Core

Ticket #25094: 25094.2.diff

File 25094.2.diff, 6.5 KB (added by DrewAPicture, 5 years ago)
  • wp-content/themes/twentyfourteen/functions.php

     
    216216add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' );
    217217
    218218/**
    219  * Enqueue Google fonts style to admin screen for custom header display.
    220  *
    221  * @return void
    222  */
    223 function twentyfourteen_admin_fonts() {
    224         wp_enqueue_style( 'twentyfourteen-lato' );
    225 }
    226 add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' );
    227 
    228 /**
    229219 * Sets the post excerpt length to 40 words.
    230220 *
    231221 * @param int $length
     
    453443add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 );
    454444
    455445/**
    456  * Implement the Custom Header feature
    457  *
    458  */
    459 require get_template_directory() . '/inc/custom-header.php';
    460 
    461 /**
    462446 * Custom template tags for this theme.
    463447 */
    464448require get_template_directory() . '/inc/template-tags.php';
  • wp-content/themes/twentyfourteen/header.php

     
    5151<div id="page" class="hfeed site">
    5252        <?php do_action( 'before' ); ?>
    5353
    54         <?php $header_image = get_header_image();
    55         if ( ! empty( $header_image ) ) : ?>
    56         <div id="site-header">
    57                 <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
    58                         <img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
    59                 </a>
    60         </div>
    61         <?php endif; ?>
    62 
    6354        <header id="masthead" class="site-header" role="banner">
    6455                <div class="header-main clear">
    6556                        <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
  • wp-content/themes/twentyfourteen/inc/custom-header.php

     
    1 <?php
    2 /**
    3  * @package WordPress
    4  * @subpackage Twenty_Fourteen
    5  */
    6 
    7 /**
    8  * Setup the WordPress core custom header feature.
    9  *
    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  *
    17  * @uses twentyfourteen_header_style()
    18  * @uses twentyfourteen_admin_header_style()
    19  * @uses twentyfourteen_admin_header_image()
    20  *
    21  * @package WordPress
    22  * @subpackage Twenty_Fourteen
    23  */
    24 function twentyfourteen_custom_header_setup() {
    25         add_theme_support( 'custom-header', apply_filters( 'twentyfourteen_custom_header_args', array(
    26                 'default-text-color'     => 'fff',
    27                 'width'                  => 1260,
    28                 'height'                 => 240,
    29                 'flex-height'            => true,
    30                 'wp-head-callback'       => 'twentyfourteen_header_style',
    31                 'admin-head-callback'    => 'twentyfourteen_admin_header_style',
    32                 'admin-preview-callback' => 'twentyfourteen_admin_header_image',
    33         ) ) );
    34 
    35 }
    36 add_action( 'after_setup_theme', 'twentyfourteen_custom_header_setup' );
    37 
    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 
    77 if ( ! function_exists( 'twentyfourteen_admin_header_style' ) ) :
    78 /**
    79  * Styles the header image displayed on the Appearance > Header admin panel.
    80  *
    81  * @see twentyfourteen_custom_header_setup().
    82  *
    83  */
    84 function twentyfourteen_admin_header_style() {
    85 ?>
    86         <style type="text/css">
    87         .appearance_page_custom-header #headimg {
    88                 background-color: #000;
    89                 border: none;
    90                 max-width: 1230px;
    91                 min-height: 48px;
    92         }
    93         #headimg h1 {
    94                 font-family: lato, sans-serif;
    95                 font-size: 18px;
    96                 line-height: 1.3333333333;
    97                 margin: 12px 0 12px 27px;
    98         }
    99         #headimg h1 a {
    100                 color: #fff;
    101                 text-decoration: none;
    102         }
    103         #headimg img {
    104                 vertical-align: middle;
    105         }
    106         </style>
    107 <?php
    108 }
    109 endif; // twentyfourteen_admin_header_style
    110 
    111 if ( ! function_exists( 'twentyfourteen_admin_header_image' ) ) :
    112 /**
    113  * Custom header image markup displayed on the Appearance > Header admin panel.
    114  *
    115  * @see twentyfourteen_custom_header_setup().
    116  *
    117  */
    118 function twentyfourteen_admin_header_image() {
    119         $header_image = get_header_image();
    120 ?>
    121         <div id="headimg">
    122                 <?php if ( ! empty( $header_image ) ) : ?>
    123                 <img src="<?php echo esc_url( $header_image ); ?>" alt="">
    124                 <?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>
    126         </div>
    127 <?php
    128 }
    129 endif; // twentyfourteen_admin_header_image
  • wp-content/themes/twentyfourteen/style.css

     
    595595.admin-bar.mp6 .site-header.masthead-fixed {
    596596        top: 32px;
    597597}
    598 #site-header {
    599         position: relative;
    600         z-index: 3;
    601 }
    602598.header-main {
    603599        margin-right: 48px;
    604600        margin-right: 4.8rem;