summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'themes/twentyfifteen/inc/custom-header.php')
-rw-r--r--themes/twentyfifteen/inc/custom-header.php84
1 files changed, 47 insertions, 37 deletions
diff --git a/themes/twentyfifteen/inc/custom-header.php b/themes/twentyfifteen/inc/custom-header.php
index 10d0ef1a..763ef00d 100644
--- a/themes/twentyfifteen/inc/custom-header.php
+++ b/themes/twentyfifteen/inc/custom-header.php
@@ -13,8 +13,8 @@
* @uses twentyfifteen_header_style()
*/
function twentyfifteen_custom_header_setup() {
- $color_scheme = twentyfifteen_get_color_scheme();
- $default_text_color = trim( $color_scheme[4], '#' );
+ $color_scheme = twentyfifteen_get_color_scheme();
+ $default_text_color = trim( $color_scheme[4], '#' );
/**
* Filter Twenty Fifteen custom-header support arguments.
@@ -31,12 +31,18 @@ function twentyfifteen_custom_header_setup() {
* displayed on the blog.
* }
*/
- add_theme_support( 'custom-header', apply_filters( 'twentyfifteen_custom_header_args', array(
- 'default-text-color' => $default_text_color,
- 'width' => 954,
- 'height' => 1300,
- 'wp-head-callback' => 'twentyfifteen_header_style',
- ) ) );
+ add_theme_support(
+ 'custom-header',
+ apply_filters(
+ 'twentyfifteen_custom_header_args',
+ array(
+ 'default-text-color' => $default_text_color,
+ 'width' => 954,
+ 'height' => 1300,
+ 'wp-head-callback' => 'twentyfifteen_header_style',
+ )
+ )
+ );
}
add_action( 'after_setup_theme', 'twentyfifteen_custom_header_setup' );
@@ -53,10 +59,10 @@ function twentyfifteen_hex2rgb( $color ) {
$color = trim( $color, '#' );
if ( strlen( $color ) == 3 ) {
- $r = hexdec( substr( $color, 0, 1 ).substr( $color, 0, 1 ) );
- $g = hexdec( substr( $color, 1, 1 ).substr( $color, 1, 1 ) );
- $b = hexdec( substr( $color, 2, 1 ).substr( $color, 2, 1 ) );
- } else if ( strlen( $color ) == 6 ) {
+ $r = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) );
+ $g = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) );
+ $b = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) );
+ } elseif ( strlen( $color ) == 6 ) {
$r = hexdec( substr( $color, 0, 2 ) );
$g = hexdec( substr( $color, 2, 2 ) );
$b = hexdec( substr( $color, 4, 2 ) );
@@ -64,32 +70,36 @@ function twentyfifteen_hex2rgb( $color ) {
return array();
}
- return array( 'red' => $r, 'green' => $g, 'blue' => $b );
+ return array(
+ 'red' => $r,
+ 'green' => $g,
+ 'blue' => $b,
+ );
}
if ( ! function_exists( 'twentyfifteen_header_style' ) ) :
-/**
- * Styles the header image and text displayed on the blog.
- *
- * @since Twenty Fifteen 1.0
- *
- * @see twentyfifteen_custom_header_setup()
- */
-function twentyfifteen_header_style() {
- $header_image = get_header_image();
+ /**
+ * Styles the header image and text displayed on the blog.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @see twentyfifteen_custom_header_setup()
+ */
+ function twentyfifteen_header_style() {
+ $header_image = get_header_image();
- // If no custom options for text are set, let's bail.
- if ( empty( $header_image ) && display_header_text() ) {
- return;
- }
+ // If no custom options for text are set, let's bail.
+ if ( empty( $header_image ) && display_header_text() ) {
+ return;
+ }
- // If we get this far, we have custom styles. Let's do this.
- ?>
- <style type="text/css" id="twentyfifteen-header-css">
- <?php
+ // If we get this far, we have custom styles. Let's do this.
+ ?>
+ <style type="text/css" id="twentyfifteen-header-css">
+ <?php
// Short header for when there is no Custom Header and Header Text is hidden.
if ( empty( $header_image ) && ! display_header_text() ) :
- ?>
+ ?>
.site-header {
padding-top: 14px;
padding-bottom: 14px;
@@ -126,12 +136,12 @@ function twentyfifteen_header_style() {
min-height: 0;
}
}
- <?php
+ <?php
endif;
// Has a Custom Header been added?
if ( ! empty( $header_image ) ) :
- ?>
+ ?>
.site-header {
/*
@@ -168,12 +178,12 @@ function twentyfifteen_header_style() {
background: transparent;
}
}
- <?php
+ <?php
endif;
// Has the text been hidden?
if ( ! display_header_text() ) :
- ?>
+ ?>
.site-title,
.site-description {
clip: rect(1px, 1px, 1px, 1px);
@@ -181,8 +191,8 @@ function twentyfifteen_header_style() {
}
<?php endif; ?>
</style>
- <?php
-}
+ <?php
+ }
endif; // twentyfifteen_header_style
/**