[wp-trac] [WordPress Trac] #23761: Empty header color after enabling header text via Customizer

WordPress Trac noreply at wordpress.org
Fri Mar 29 05:11:25 UTC 2013


#23761: Empty header color after enabling header text via Customizer
----------------------------+------------------
 Reporter:  SergeyBiryukov  |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  3.6
Component:  Appearance      |     Version:  3.4
 Severity:  normal          |  Resolution:
 Keywords:                  |
----------------------------+------------------
Changes (by agilexcmer):

 * cc: agilexcmer (added)


Comment:

 This is for TwentyThirteen. In Line 217 of wp-admin/custom-header.php:


 {{{
 if ( isset( $_POST['text-color'] ) && ! isset( $_POST['display-header-
 text'] ) ) {
                         check_admin_referer( 'custom-header-options',
 '_wpnonce-custom-header-options' );
                         set_theme_mod( 'header_textcolor', 'blank' );
                 } elseif ( isset( $_POST['text-color'] ) ) {
                         check_admin_referer( 'custom-header-options',
 '_wpnonce-custom-header-options' );
                         $_POST['text-color'] = str_replace( '#', '',
 $_POST['text-color'] );
                         $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST
 ['text-color']);
                         if ( strlen($color) == 6 || strlen($color) == 3 )
                                 set_theme_mod('header_textcolor', $color);
                         elseif ( ! $color )
                                 set_theme_mod( 'header_textcolor', 'blank'
 );
                 }
 }}}

 If the header text is disabled, WP sets the colour option to the string
 "blank" (and also for cases where the colour is invalid). This is how it
 knows whether you have the header text set or not.

 When the customizer loads, the backend will provide it with an invalid
 color (string "blank") to begin with. I think this is filtered somewhere
 to then become an empty string.

 Enabling the header in the customizer shows the header color option, which
 deceptively shows a colour. The actual colour is invalid (just a "#"), but
 then the browser applies the default colour for anchor tags. When you save
 the header in the customizer, it saves it with an empty string colour (you
 can check this in the database, serialized value theme_mods_twentythirteen
 in wp_options).

 In the Appearance->Header, the colour is again invalid, but the header
 anchor tag has a default colour blue, which is what you see. The default
 colour for the colour-picker's anchor is different, which is why it shows
 something whitish.

 I think the problem comes from the fact that we're re-using the header
 colour to determine if the header is enabled or not.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23761#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list