Skip to content

Instantly share code, notes, and snippets.

@danemorgan
Last active January 19, 2017 22:50
Show Gist options
  • Save danemorgan/33fc144793bee923c2311b585e3515bb to your computer and use it in GitHub Desktop.
Save danemorgan/33fc144793bee923c2311b585e3515bb to your computer and use it in GitHub Desktop.
Checking for custom options in WordPress Customizer. Don't use HEADER_TEXTCOLOR
<?php
/**
* Do it this way instead
***********************************************/
/*
* If no custom options for text are set, let's bail.
* get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: add_theme_support( 'custom-header' ).
*/
if ( get_theme_support( 'custom-header', 'default-text-color' ) === $header_text_color ) {
return;
}
// If we get this far, we have custom styles. Let's do this.
<?php
/**
* This is the wron way to check because the HEADER_TEXTCOLOR constant is deprecated.
***********************************************/
/*
* If no custom options for text are set, let's bail.
* get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: HEADER_TEXTCOLOR.
*/
if ( HEADER_TEXTCOLOR === $header_text_color ) {
return;
}
// If we get this far, we have custom styles. Let's do this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment