WordPress.org

Make WordPress Core

Changeset 30230


Ignore:
Timestamp:
11/04/2014 06:41:56 PM (6 years ago)
Author:
iandstewart
Message:

Twenty Fifteen: Simplify the header, sidebar, background controls and make customization faster for users to do. This has the added benefit of fixing our bug where hidden header text wasn't being updated on color scheme switch. Nice.

Props celloexpressions, iamtakashi, fixes #30164 and #29980.

Location:
trunk/src/wp-content/themes/twentyfifteen
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfifteen/css/admin-custom-header.css

    r30046 r30230  
    3333    margin-top: 0.5em;
    3434    opacity: 0.7;
     35}
     36
     37/* Hide the header text color option */
     38.appearance_page_custom-header tr.displaying-header-text {
     39    display: none;
    3540}
    3641
  • trunk/src/wp-content/themes/twentyfifteen/inc/custom-header.php

    r30221 r30230  
    8080function twentyfifteen_header_style() {
    8181    $header_image = get_header_image();
    82     $text_color   = get_header_textcolor();
    8382
    8483    // If no custom options for text are set, let's bail.
    85     if ( empty( $header_image ) && $text_color == get_theme_support( 'custom-header', 'default-text-color' ) ) {
     84    if ( empty( $header_image ) && display_header_text() ) {
    8685        return;
    8786    }
     
    126125            position: absolute;
    127126        }
    128     <?php
    129         // If the user has set a custom color for the text use that
    130         elseif ( $text_color != get_theme_support( 'custom-header', 'default-text-color' ) ) :
    131     ?>
    132         .site-title a,
    133         .site-title a:hover,
    134         .site-title a:focus,
    135         .site-description {
    136             color: #<?php echo esc_attr( $text_color ); ?>;
    137         }
    138127    <?php endif; ?>
    139128    </style>
     
    229218    $css = '
    230219        /* Custom Sidebar Text Color */
     220        .site-title a,
     221        .site-description,
    231222        .secondary-toggle:before {
    232223            color: %1$s;
     224        }
     225
     226        .site-title a:hover,
     227        .site-title a:focus {
     228            color: %1$s; /* Fallback for IE7 and IE8 */
     229            color: %2$s;
    233230        }
    234231
  • trunk/src/wp-content/themes/twentyfifteen/inc/customizer.php

    r30208 r30230  
    3636    ) );
    3737
    38     // Add custom sidebar text color setting and control.
     38    // Add custom header and sidebar text color setting and control.
    3939    $wp_customize->add_setting( 'sidebar_textcolor', array(
    4040        'default'           => $color_scheme[4],
     
    4343
    4444    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sidebar_textcolor', array(
    45         'label'   => __( 'Sidebar Text Color', 'twentyfifteen' ),
     45        'label'   => esc_html__( 'Header &amp; Sidebar Text Color', 'twentyfifteen' ),
    4646        'section' => 'colors',
    4747    ) ) );
    4848
    49     // Add custom header background color setting and control.
     49    // Remove the core header textcolor control, as it shares the sidebar text color.
     50    $wp_customize->remove_control( 'header_textcolor' );
     51
     52    // Add custom header and sidebar background color setting and control.
    5053    $wp_customize->add_setting( 'header_background_color', array(
    5154        'default'           => $color_scheme[1],
     
    5457
    5558    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_background_color', array(
    56         'label'   => esc_html__( 'Header & Sidebar Background Color', 'twentyfifteen' ),
     59        'label'   => esc_html__( 'Header &amp; Sidebar Background Color', 'twentyfifteen' ),
    5760        'section' => 'colors',
    5861    ) ) );
  • trunk/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js

    r30126 r30230  
    1111            if ( 'color_scheme' === this.id ) {
    1212                this.setting.bind( 'change', function( value ) {
    13                     // If Header Text is not hidden, update value.
    14                     if ( 'blank' !== api( 'header_textcolor' ).get() ) {
    15                         api( 'header_textcolor' ).set( colorScheme[value].colors[4] );
    16                         api.control( 'header_textcolor' ).container.find( '.color-picker-hex' )
    17                             .data( 'data-default-color', colorScheme[value].colors[4] )
    18                             .wpColorPicker( 'defaultColor', colorScheme[value].colors[4] );
    19                     }
    20 
    2113                    // Update Background Color.
    2214                    api( 'background_color' ).set( colorScheme[value].colors[0] );
     
    3123                        .wpColorPicker( 'defaultColor', colorScheme[value].colors[1] );
    3224
    33                     // Update Sidebar Text Color.
     25                    // Update Header/Sidebar Text Color.
    3426                    api( 'sidebar_textcolor' ).set( colorScheme[value].colors[4] );
    3527                    api.control( 'sidebar_textcolor' ).container.find( '.color-picker-hex' )
Note: See TracChangeset for help on using the changeset viewer.