Skip to main content
Typo fix
Source Link
Fayaz
  • 9k
  • 2
  • 32
  • 51

First of all, When you uncheck Display Site Title and Tagline in the customizer, it doesn't matter what value you've already put in Header Text Color, the customizer saves it as blank (not empty string, the actual text "blank") after you Save & Publish. You may check this in wp_options table in the database after you Save & Publish or try var_dump() after moving out of the customizer.

Since get_header_textcolor() returns blank and get_theme_support( 'custom-header', 'default-text-color' ) returns 000000, they don't match in the above mentioned if condition, so the hiding works.

Secondly, you get 000000 with var_dump() for both get_header_textcolor() and get_theme_support( 'custom-header', 'default-text-color' ) when you are in the customizer, because customizer doesn't reload the page after saving & useit uses JavaScript to show / hide Title & Tagline before saving. If you close the customizer after saving, you'll see that var_dump() will show blank for get_header_textcolor() and 000000 for get_theme_support( 'custom-header', 'default-text-color' ).

This is the line the customizer uses to save the value as blank in the wp-admin/js/customize-controls.js file:

    control.setting.set( to ? last : 'blank' );

Also, in wp-includes/class-wp-customize-manager.php file's _sanitize_header_textcolor function, you'll see that WordPress allows blank to be a valid input for header_textcolor along with any valid color value in hex format:

    if ( 'blank' === $color )
        return 'blank';

So your logic was correct, but you got the value wrong.

First of all, When you uncheck Display Site Title and Tagline in the customizer, it doesn't matter what value you've already put in Header Text Color, the customizer saves it as blank (not empty string, the actual text "blank") after you Save & Publish. You may check this in wp_options table in the database after you Save & Publish or try var_dump() after moving out of the customizer.

Since get_header_textcolor() returns blank and get_theme_support( 'custom-header', 'default-text-color' ) returns 000000, they don't match in the above mentioned if condition, so the hiding works.

Secondly, you get 000000 with var_dump() for both get_header_textcolor() and get_theme_support( 'custom-header', 'default-text-color' ) when you are in the customizer, because customizer doesn't reload the page after saving & use JavaScript to show / hide before saving. If you close the customizer after saving, you'll see that var_dump() will show blank for get_header_textcolor() and 000000 for get_theme_support( 'custom-header', 'default-text-color' ).

This is the line the customizer uses to save the value as blank in the wp-admin/js/customize-controls.js file:

    control.setting.set( to ? last : 'blank' );

Also, in wp-includes/class-wp-customize-manager.php file's _sanitize_header_textcolor function, you'll see that WordPress allows blank to be a valid input for header_textcolor along with any valid color value in hex format:

    if ( 'blank' === $color )
        return 'blank';

So your logic was correct, but you got the value wrong.

First of all, When you uncheck Display Site Title and Tagline in the customizer, it doesn't matter what value you've already put in Header Text Color, the customizer saves it as blank (not empty string, the actual text "blank") after you Save & Publish. You may check this in wp_options table in the database after you Save & Publish or try var_dump() after moving out of the customizer.

Since get_header_textcolor() returns blank and get_theme_support( 'custom-header', 'default-text-color' ) returns 000000, they don't match in the above mentioned if condition, so the hiding works.

Secondly, you get 000000 with var_dump() for both get_header_textcolor() and get_theme_support( 'custom-header', 'default-text-color' ) when you are in the customizer, because customizer doesn't reload the page after saving & it uses JavaScript to show / hide Title & Tagline before saving. If you close the customizer after saving, you'll see that var_dump() will show blank for get_header_textcolor() and 000000 for get_theme_support( 'custom-header', 'default-text-color' ).

This is the line the customizer uses to save the value as blank in the wp-admin/js/customize-controls.js file:

    control.setting.set( to ? last : 'blank' );

Also, in wp-includes/class-wp-customize-manager.php file's _sanitize_header_textcolor function, you'll see that WordPress allows blank to be a valid input for header_textcolor along with any valid color value in hex format:

    if ( 'blank' === $color )
        return 'blank';

So your logic was correct, but you got the value wrong.

Typo fix
Source Link
Fayaz
  • 9k
  • 2
  • 32
  • 51

First of all, When you uncheck Display Site Title and Tagline in the customizer, it doesn't matter what value you've already put in Header Text Color, the customizer saves it as blank (not empty string, the actual text "blank") after you Save & Publish. You may check this in wp_options table in the database after you Save & Publish or try var_dump() after moving out of the customizer.

Since get_header_textcolor() returns blank and get_theme_support( 'custom-header', 'default-text-color' ) returns 000000, they don't match in the above mentioned if condition, so the hiding works.

Secondly, you get 000000 with var_dump() for both get_header_textcolor() and get_theme_support( 'custom-header', 'default-text-color' ) when you are in the customizer, because customizer don'tdoesn't reload the page after saving & use JavaScript to show / hide before saving. If you close the customizer after saving, you'll see that var_dump() will show blank for get_header_textcolor() and 000000 for get_theme_support( 'custom-header', 'default-text-color' ).

This is the line the customizer uses to save the value as blank in the wp-admin/js/customize-controls.js file:

    control.setting.set( to ? last : 'blank' );

Also, in wp-includes/class-wp-customize-manager.php file's _sanitize_header_textcolor function, you'll see that WordPress allows blank to be a valid input for header_textcolor along with any valid color value in hex format:

    if ( 'blank' === $color )
        return 'blank';

So your logic was correct, but you got the value wrong.

First of all, When you uncheck Display Site Title and Tagline in the customizer, it doesn't matter what value you've already put in Header Text Color, the customizer saves it as blank (not empty string, the actual text "blank") after you Save & Publish. You may check this in wp_options table in the database after you Save & Publish or try var_dump() after moving out of the customizer.

Since get_header_textcolor() returns blank and get_theme_support( 'custom-header', 'default-text-color' ) returns 000000, they don't match in the above mentioned if condition, so the hiding works.

Secondly, you get 000000 with var_dump() for both get_header_textcolor() and get_theme_support( 'custom-header', 'default-text-color' ) when you are in the customizer, because customizer don't reload the page after saving & use JavaScript to show / hide before saving. If you close the customizer after saving, you'll see that var_dump() will show blank for get_header_textcolor() and 000000 for get_theme_support( 'custom-header', 'default-text-color' ).

This is the line the customizer uses to save the value as blank in the wp-admin/js/customize-controls.js file:

    control.setting.set( to ? last : 'blank' );

Also, in wp-includes/class-wp-customize-manager.php file's _sanitize_header_textcolor function, you'll see that WordPress allows blank to be a valid input for header_textcolor along with any valid color value in hex format:

    if ( 'blank' === $color )
        return 'blank';

So your logic was correct, but you got the value wrong.

First of all, When you uncheck Display Site Title and Tagline in the customizer, it doesn't matter what value you've already put in Header Text Color, the customizer saves it as blank (not empty string, the actual text "blank") after you Save & Publish. You may check this in wp_options table in the database after you Save & Publish or try var_dump() after moving out of the customizer.

Since get_header_textcolor() returns blank and get_theme_support( 'custom-header', 'default-text-color' ) returns 000000, they don't match in the above mentioned if condition, so the hiding works.

Secondly, you get 000000 with var_dump() for both get_header_textcolor() and get_theme_support( 'custom-header', 'default-text-color' ) when you are in the customizer, because customizer doesn't reload the page after saving & use JavaScript to show / hide before saving. If you close the customizer after saving, you'll see that var_dump() will show blank for get_header_textcolor() and 000000 for get_theme_support( 'custom-header', 'default-text-color' ).

This is the line the customizer uses to save the value as blank in the wp-admin/js/customize-controls.js file:

    control.setting.set( to ? last : 'blank' );

Also, in wp-includes/class-wp-customize-manager.php file's _sanitize_header_textcolor function, you'll see that WordPress allows blank to be a valid input for header_textcolor along with any valid color value in hex format:

    if ( 'blank' === $color )
        return 'blank';

So your logic was correct, but you got the value wrong.

Typo & Grammar fix
Source Link
Fayaz
  • 9k
  • 2
  • 32
  • 51

First of all, When you uncheck Display Site Title and Tagline in the customizer, it doesn't matter what value you've already put in Header Text Color, the customizer saves it as blank (not empty string, the actual text "blank") after you Save & Publish. You may check this in wp_options table in the database after you Save & Publish or try var_dump()` or try var_dump() after moving out of the customizer.

Since get_header_textcolor() returns blank and get_theme_support( 'custom-header', 'default-text-color' ) returns 000000, they don't match in the above mentioned if condition, so the hiding works.

Secondly, you get 000000 with var_dump() for both get_header_textcolor() and get_theme_support( 'custom-header', 'default-text-color' ) when you are in the customizer because, because customizer don't reload the page after saving & use JavaScript to show / hide before saving. If you close the customizer after saving, you'll see that var_dump() will show blank for get_header_textcolor() and 000000 for get_theme_support( 'custom-header', 'default-text-color' ).

This is the line the customizer useuses to save the value as blank in the wp-admin/js/customize-controls.js file:

    control.setting.set( to ? last : 'blank' );

Also, in wp-includes/class-wp-customize-manager.php file's _sanitize_header_textcolor function, you'll see that WordPress allows blank to be a valid input for header-text-color other thanheader_textcolor along with any valid color value in hex format:

    if ( 'blank' === $color )
        return 'blank';

So your logic was correct, but you got the value wrong.

First of all, When you uncheck Display Site Title and Tagline in the customizer, it doesn't matter what value you've already put in Header Text Color, the customizer saves it as blank (not empty string, the actual text "blank") after you Save & Publish. You may check this in wp_options table in the database after you Save & Publish or try var_dump()` after moving out of the customizer.

Since get_header_textcolor() returns blank and get_theme_support( 'custom-header', 'default-text-color' ) returns 000000, they don't match in the above mentioned if condition, so the hiding works.

Secondly, you get 000000 with var_dump() for both get_header_textcolor() and get_theme_support( 'custom-header', 'default-text-color' ) when you are in the customizer because, customizer don't reload the page after saving & use JavaScript to show / hide before saving. If you close customizer, you'll see var_dump() will show blank for get_header_textcolor() and 000000 for get_theme_support( 'custom-header', 'default-text-color' ).

This is the line customizer use to save the value as blank in the wp-admin/js/customize-controls.js file:

    control.setting.set( to ? last : 'blank' );

Also, in wp-includes/class-wp-customize-manager.php file's _sanitize_header_textcolor function, you'll see that WordPress allows blank to be a valid input for header-text-color other than valid color value in hex format:

    if ( 'blank' === $color )
        return 'blank';

So your logic was correct, but you got the value wrong.

First of all, When you uncheck Display Site Title and Tagline in the customizer, it doesn't matter what value you've already put in Header Text Color, the customizer saves it as blank (not empty string, the actual text "blank") after you Save & Publish. You may check this in wp_options table in the database after you Save & Publish or try var_dump() after moving out of the customizer.

Since get_header_textcolor() returns blank and get_theme_support( 'custom-header', 'default-text-color' ) returns 000000, they don't match in the above mentioned if condition, so the hiding works.

Secondly, you get 000000 with var_dump() for both get_header_textcolor() and get_theme_support( 'custom-header', 'default-text-color' ) when you are in the customizer, because customizer don't reload the page after saving & use JavaScript to show / hide before saving. If you close the customizer after saving, you'll see that var_dump() will show blank for get_header_textcolor() and 000000 for get_theme_support( 'custom-header', 'default-text-color' ).

This is the line the customizer uses to save the value as blank in the wp-admin/js/customize-controls.js file:

    control.setting.set( to ? last : 'blank' );

Also, in wp-includes/class-wp-customize-manager.php file's _sanitize_header_textcolor function, you'll see that WordPress allows blank to be a valid input for header_textcolor along with any valid color value in hex format:

    if ( 'blank' === $color )
        return 'blank';

So your logic was correct, but you got the value wrong.

Added more related code
Source Link
Fayaz
  • 9k
  • 2
  • 32
  • 51
Loading
Source Link
Fayaz
  • 9k
  • 2
  • 32
  • 51
Loading