dane-m
1/19/2017 - 10:50 PM

Checking for custom options in WordPress Customizer. Don't use HEADER_TEXTCOLOR

Checking for custom options in WordPress Customizer. Don't use HEADER_TEXTCOLOR

<?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.
<?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.