From 17dbe26df9852111fec90d07c6a2c4482240b23f Mon Sep 17 00:00:00 2001 From: Ian Stewart Date: Tue, 4 Nov 2014 18:42:22 +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. Built from https://develop.svn.wordpress.org/trunk@30230 git-svn-id: http://core.svn.wordpress.org/trunk@30230 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../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 +-------- wp-includes/version.php | 2 +- 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/wp-content/themes/twentyfifteen/css/admin-custom-header.css b/wp-content/themes/twentyfifteen/css/admin-custom-header.css index 72db5f514d..b5474d18d7 100644 --- a/wp-content/themes/twentyfifteen/css/admin-custom-header.css +++ b/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/wp-content/themes/twentyfifteen/inc/custom-header.php b/wp-content/themes/twentyfifteen/inc/custom-header.php index 12b30c29ca..69f8b3438a 100644 --- a/wp-content/themes/twentyfifteen/inc/custom-header.php +++ b/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/wp-content/themes/twentyfifteen/js/color-scheme-control.js b/wp-content/themes/twentyfifteen/js/color-scheme-control.js index 94c575385c..7480e57116 100644 --- a/wp-content/themes/twentyfifteen/js/color-scheme-control.js +++ b/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] ) diff --git a/wp-includes/version.php b/wp-includes/version.php index ef4d1b3e83..800a47a49d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.1-alpha-30229'; +$wp_version = '4.1-alpha-30230'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.