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
This commit is contained in:
Ian Stewart 2014-11-04 18:42:22 +00:00
parent cc9c8edf83
commit 17dbe26df9
5 changed files with 23 additions and 26 deletions

View File

@ -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;

View File

@ -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;
}
<?php
// If the user has set a custom color for the text use that
elseif ( $text_color != get_theme_support( 'custom-header', 'default-text-color' ) ) :
?>
.site-title a,
.site-title a:hover,
.site-title a:focus,
.site-description {
color: #<?php echo esc_attr( $text_color ); ?>;
}
<?php endif; ?>
</style>
<?php
@ -228,10 +217,18 @@ function twentyfifteen_sidebar_text_color_css() {
$css = '
/* Custom Sidebar Text Color */
.site-title a,
.site-description,
.secondary-toggle:before {
color: %1$s;
}
.site-title a:hover,
.site-title a:focus {
color: %1$s; /* Fallback for IE7 and IE8 */
color: %2$s;
}
.secondary-toggle {
border-color: %1$s; /* Fallback for IE7 and IE8 */
border-color: %3$s;

View File

@ -35,25 +35,28 @@ function twentyfifteen_customize_register( $wp_customize ) {
'priority' => 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 &amp; 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 &amp; Sidebar Background Color', 'twentyfifteen' ),
'section' => 'colors',
) ) );
}

View File

@ -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] )

View File

@ -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.