Custom Header: Fix logic when a theme doesn't set `default-text-color`.
fixes #28042. Built from https://develop.svn.wordpress.org/trunk@28294 git-svn-id: http://core.svn.wordpress.org/trunk@28122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
970477d25e
commit
f7539feb4d
|
@ -325,11 +325,20 @@ class Custom_Image_Header {
|
|||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
function js_1() { ?>
|
||||
function js_1() {
|
||||
$default_color = '';
|
||||
if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) {
|
||||
$default_color = get_theme_support( 'custom-header', 'default-text-color' );
|
||||
if ( $default_color && false === strpos( $default_color, '#' ) ) {
|
||||
$default_color = '#' . $default_color;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
(function($){
|
||||
var default_color = '#<?php echo get_theme_support( 'custom-header', 'default-text-color' ); ?>',
|
||||
var default_color = '<?php echo $default_color; ?>',
|
||||
header_text_fields;
|
||||
|
||||
function pickColor(color) {
|
||||
|
@ -625,14 +634,24 @@ class Custom_Image_Header {
|
|||
<td>
|
||||
<p>
|
||||
<?php
|
||||
$header_textcolor = display_header_text() ? get_header_textcolor() : get_theme_support( 'custom-header', 'default-text-color' );
|
||||
|
||||
$default_color = '';
|
||||
if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) {
|
||||
$default_color = '#' . get_theme_support( 'custom-header', 'default-text-color' );
|
||||
$default_color_attr = ' data-default-color="' . esc_attr( $default_color ) . '"';
|
||||
echo '<input type="text" name="text-color" id="text-color" value="#' . esc_attr( $header_textcolor ) . '"' . $default_color_attr . ' />';
|
||||
if ( $default_color )
|
||||
echo ' <span class="description hide-if-js">' . sprintf( _x( 'Default: %s', 'color' ), $default_color ) . '</span>';
|
||||
$default_color = get_theme_support( 'custom-header', 'default-text-color' );
|
||||
if ( $default_color && false === strpos( $default_color, '#' ) ) {
|
||||
$default_color = '#' . $default_color;
|
||||
}
|
||||
}
|
||||
|
||||
$default_color_attr = $default_color ? ' data-default-color="' . esc_attr( $default_color ) . '"' : '';
|
||||
|
||||
$header_textcolor = display_header_text() ? get_header_textcolor() : get_theme_support( 'custom-header', 'default-text-color' );
|
||||
if ( $header_textcolor && false === strpos( $header_textcolor, '#' ) ) {
|
||||
$header_textcolor = '#' . $header_textcolor;
|
||||
}
|
||||
|
||||
echo '<input type="text" name="text-color" id="text-color" value="' . esc_attr( $header_textcolor ) . '"' . $default_color_attr . ' />';
|
||||
if ( $default_color ) {
|
||||
echo ' <span class="description hide-if-js">' . sprintf( _x( 'Default: %s', 'color' ), esc_html( $default_color ) ) . '</span>';
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
|
|
Loading…
Reference in New Issue