_s: Cache header text color value;

This commit is contained in:
obenland 2013-05-20 13:01:22 +02:00
parent 655ee71d60
commit c1960ec122
1 changed files with 12 additions and 7 deletions

View File

@ -91,17 +91,19 @@ if ( ! function_exists( '_s_header_style' ) ) :
* @see _s_custom_header_setup().
*/
function _s_header_style() {
$header_text_color = get_header_textcolor();
// If no custom options for text are set, let's bail
// get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value
if ( HEADER_TEXTCOLOR == get_header_textcolor() )
if ( HEADER_TEXTCOLOR == $header_text_color )
return;
// If we get this far, we have custom styles. Let's do this.
?>
<style type="text/css">
<?php
// Has the text been hidden?
if ( 'blank' == get_header_textcolor() ) :
if ( 'blank' == $header_text_color ) :
?>
.site-title,
.site-description {
@ -115,7 +117,7 @@ function _s_header_style() {
?>
.site-title a,
.site-description {
color: #<?php echo get_header_textcolor(); ?>;
color: #<?php echo $header_text_color; ?>;
}
<?php endif; ?>
</style>
@ -157,13 +159,15 @@ if ( ! function_exists( '_s_admin_header_image' ) ) :
*
* @see _s_custom_header_setup().
*/
function _s_admin_header_image() { ?>
function _s_admin_header_image() {
$header_text_color = get_header_textcolor();
?>
<div id="headimg">
<?php
if ( 'blank' == get_header_textcolor() || '' == get_header_textcolor() )
if ( 'blank' == $header_text_color || '' == $header_text_color )
$style = ' style="display:none;"';
else
$style = ' style="color:#' . get_header_textcolor() . ';"';
$style = ' style="color:#' . $header_text_color . ';"';
?>
<h1 class="displaying-header-text"><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
<div class="displaying-header-text" id="desc"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
@ -172,5 +176,6 @@ function _s_admin_header_image() { ?>
<img src="<?php echo esc_url( $header_image ); ?>" alt="" />
<?php endif; ?>
</div>
<?php }
<?php
}
endif; // _s_admin_header_image