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
This commit is contained in:
parent
2045e94fc2
commit
47c5c58e47
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 & 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',
|
||||
) ) );
|
||||
}
|
||||
|
@ -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] )
|
||||
|
Loading…
Reference in New Issue
Block a user