Header screen. * } */ 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', 'admin-preview-callback' => 'twentyfifteen_admin_header_image', ) ) ); } add_action( 'after_setup_theme', 'twentyfifteen_custom_header_setup' ); /** * Convert HEX to RGB. * * @since Twenty Fifteen 1.0 * * @param string $color The original color, in 3- or 6-digit hexadecimal form. * @return array */ 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, 2 ) ); $g = hexdec( substr( $color, 2, 2 ) ); $b = hexdec( substr( $color, 4, 2 ) ); } else { return array(); } 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(); $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' ) ) { return; } // If we get this far, we have custom styles. Let's do this. ?> Header admin panel. * * @since Twenty Fifteen 1.0 * @see twentyfifteen_custom_header_setup(). */ function twentyfifteen_admin_header_image() { $style = sprintf( ' style="color:#%s;"', get_header_textcolor() ); $color_scheme = twentyfifteen_get_color_scheme(); $header_background_color = get_theme_mod( 'header_background_color', $color_scheme[1] ); ?>