From 47c5c58e471a75ef874d49d29aa599d1b700155a Mon Sep 17 00:00:00 2001 From: Ian Stewart Date: Tue, 4 Nov 2014 18:41:56 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@30230 602fd350-edb4-49c9-b593-d223f7449a82 --- .../twentyfifteen/css/admin-custom-header.css | 5 +++++ .../twentyfifteen/inc/custom-header.php | 21 ++++++++----------- .../themes/twentyfifteen/inc/customizer.php | 11 ++++++---- .../twentyfifteen/js/color-scheme-control.js | 10 +-------- 4 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/wp-content/themes/twentyfifteen/css/admin-custom-header.css b/src/wp-content/themes/twentyfifteen/css/admin-custom-header.css index 72db5f514d..b5474d18d7 100644 --- a/src/wp-content/themes/twentyfifteen/css/admin-custom-header.css +++ b/src/wp-content/themes/twentyfifteen/css/admin-custom-header.css @@ -34,6 +34,11 @@ Description: Used to style the header image displayed on the Appearance > Header opacity: 0.7; } +/* Hide the header text color option */ +.appearance_page_custom-header tr.displaying-header-text { + display: none; +} + @media screen and (min-width: 772px) { #headimg h1 { font-size: 29px; diff --git a/src/wp-content/themes/twentyfifteen/inc/custom-header.php b/src/wp-content/themes/twentyfifteen/inc/custom-header.php index 12b30c29ca..69f8b3438a 100644 --- a/src/wp-content/themes/twentyfifteen/inc/custom-header.php +++ b/src/wp-content/themes/twentyfifteen/inc/custom-header.php @@ -79,10 +79,9 @@ if ( ! function_exists( 'twentyfifteen_header_style' ) ) : */ function twentyfifteen_header_style() { $header_image = get_header_image(); - $text_color = get_header_textcolor(); // If no custom options for text are set, let's bail. - if ( empty( $header_image ) && $text_color == get_theme_support( 'custom-header', 'default-text-color' ) ) { + if ( empty( $header_image ) && display_header_text() ) { return; } @@ -125,16 +124,6 @@ function twentyfifteen_header_style() { clip: rect(1px, 1px, 1px, 1px); position: absolute; } - - .site-title a, - .site-title a:hover, - .site-title a:focus, - .site-description { - color: #; - } 1, ) ); - // Add custom sidebar text color setting and control. + // Add custom header and sidebar text color setting and control. $wp_customize->add_setting( 'sidebar_textcolor', array( 'default' => $color_scheme[4], 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sidebar_textcolor', array( - 'label' => __( 'Sidebar Text Color', 'twentyfifteen' ), + 'label' => esc_html__( 'Header & Sidebar Text Color', 'twentyfifteen' ), 'section' => 'colors', ) ) ); - // Add custom header background color setting and control. + // Remove the core header textcolor control, as it shares the sidebar text color. + $wp_customize->remove_control( 'header_textcolor' ); + + // Add custom header and sidebar background color setting and control. $wp_customize->add_setting( 'header_background_color', array( 'default' => $color_scheme[1], 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_background_color', array( - 'label' => esc_html__( 'Header & Sidebar Background Color', 'twentyfifteen' ), + 'label' => esc_html__( 'Header & Sidebar Background Color', 'twentyfifteen' ), 'section' => 'colors', ) ) ); } diff --git a/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js b/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js index 94c575385c..7480e57116 100644 --- a/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js +++ b/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js @@ -10,14 +10,6 @@ ready: function() { if ( 'color_scheme' === this.id ) { this.setting.bind( 'change', function( value ) { - // If Header Text is not hidden, update value. - if ( 'blank' !== api( 'header_textcolor' ).get() ) { - api( 'header_textcolor' ).set( colorScheme[value].colors[4] ); - api.control( 'header_textcolor' ).container.find( '.color-picker-hex' ) - .data( 'data-default-color', colorScheme[value].colors[4] ) - .wpColorPicker( 'defaultColor', colorScheme[value].colors[4] ); - } - // Update Background Color. api( 'background_color' ).set( colorScheme[value].colors[0] ); api.control( 'background_color' ).container.find( '.color-picker-hex' ) @@ -30,7 +22,7 @@ .data( 'data-default-color', colorScheme[value].colors[1] ) .wpColorPicker( 'defaultColor', colorScheme[value].colors[1] ); - // Update Sidebar Text Color. + // Update Header/Sidebar Text Color. api( 'sidebar_textcolor' ).set( colorScheme[value].colors[4] ); api.control( 'sidebar_textcolor' ).container.find( '.color-picker-hex' ) .data( 'data-default-color', colorScheme[value].colors[4] )