Twenty Fourteen: better logic for hide/show title and description, and Customizer handling of the same. Add ID attributes to style blocks. Fixes #26338.

Built from https://develop.svn.wordpress.org/trunk@26668


git-svn-id: http://core.svn.wordpress.org/trunk@26558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2013-12-05 17:30:11 +00:00
parent 21d946cf52
commit 25ee6100bd
2 changed files with 18 additions and 17 deletions

View File

@ -55,30 +55,31 @@ if ( ! function_exists( 'twentyfourteen_header_style' ) ) :
*
*/
function twentyfourteen_header_style() {
$header_text_color = get_header_textcolor();
$text_color = get_header_textcolor();
// If no custom options for text are set, let's bail
// $header_text_color options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value
if ( HEADER_TEXTCOLOR == $header_text_color )
// If no custom color for text is set, let's bail.
if ( display_header_text() && $text_color === get_theme_support( 'custom-header', 'default-text-color' ) )
return;
// If we get this far, we have custom styles. Let's do this.
// If we get this far, we have custom styles.
?>
<style type="text/css">
<style type="text/css" id="twentyfourteen-header-css">
<?php
// Has the text been hidden?
if ( 'blank' == $header_text_color ) :
if ( ! display_header_text() ) :
?>
.site-title {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
.site-title,
.site-description {
position: absolute;
clip: rect(1px 1px 1px 1px); /* IE7 */
clip: rect(1px, 1px, 1px, 1px);
}
<?php
// If the user has set a custom color for the text use that
else :
// 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 {
color: #<?php echo $header_text_color; ?>;
color: #<?php echo esc_attr( $text_color ); ?>;
}
<?php endif; ?>
</style>
@ -97,7 +98,7 @@ if ( ! function_exists( 'twentyfourteen_admin_header_style' ) ) :
*/
function twentyfourteen_admin_header_style() {
?>
<style type="text/css">
<style type="text/css" id="twentyfourteen-admin-header-css">
.appearance_page_custom-header #headimg {
background-color: #000;
border: none;

View File

@ -19,14 +19,14 @@
wp.customize( 'header_textcolor', function( value ) {
value.bind( function( to ) {
if ( 'blank' === to ) {
$( '.site-title a, .site-description' ).css( {
$( '.site-title, .site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)',
'position': 'absolute'
} );
} else {
$( '.site-title a, .site-description' ).css( {
$( '.site-title, .site-description' ).css( {
'clip': 'auto',
'position': 'relative'
'position': 'static'
} );
$( '.site-title a' ).css( {