<?php
/**
 * Sample implementation of the Custom Header feature
 *
 * You can add an optional custom header image to header.php like so ...
 *
	<?php the_header_image_tag(); ?>
 *
 * @link https://developer.wordpress.org/themes/functionality/custom-headers/
 *
 * @package guj
 */

/**
 * Set up the WordPress core custom header feature.
 *
 * @uses guj_header_style()
 */
function guj_custom_header_setup() {
	add_theme_support( 'custom-header', apply_filters( 'guj_custom_header_args', array(
		'default-image'          => '',
		'default-text-color'     => 'ffffff',
		'width'                  => 2000,
		'height'                 => 850,
		'flex-height'            => true,
		'wp-head-callback'       => 'guj_header_style',
	) ) );
}
add_action( 'after_setup_theme', 'guj_custom_header_setup' );


if ( ! function_exists( 'guj_header_style' ) ) :
/**
 * Styles the header text and background color
 *
 * @see guj_custom_header_setup().
 */
function guj_header_style() {
	$header_text_color = get_header_textcolor();
	$header_bg_color = guj_get_option( 'header_bg_color' );	

	
	if ( $header_text_color != '#fff' ) {

		/*
                 * Do we have a custom header text color?
                 */
		?>
		<style type="text/css">
		<?php
			// Has the text been hidden?
			if ( ! display_header_text() ) :
		?>
			.site-title,
			.site-description {
				position: absolute;
				clip: rect(1px, 1px, 1px, 1px);
			}
		<?php
			// If the user has set a custom color for header.
			else :
		?>
			.site-title a,
			.site-description {
				color: #<?php echo esc_attr( $header_text_color ); ?>;
			}
		<?php endif; ?>
			.main-navigation a,
			button.dropdown-toggle,
			.menu-toggle,
			.site-footer,
			.site-footer a {
				color: #<?php echo esc_attr( $header_text_color ); ?>;
			}

			.menu-toggle,
			.custom-logo-link:focus > img, .custom-logo-link:hover > img {
				outline-color: #<?php echo esc_attr( $header_text_color ); ?>;
			}

			button.menu-toggle:hover,
			button.menu-toggle:focus {
				color: <?php echo esc_attr( $header_bg_color ); ?>;
				background-color: #<?php echo esc_attr( $header_text_color ); ?>;
			}
		</style>
		<?php
	}
	
	/*
	 * Do we have a custom header background color?
	 */
	if ( '#424B54' != $header_bg_color ) { ?>
		<style type="text/css">
			.site-header {
				background-color: <?php echo esc_attr( $header_bg_color ); ?>;
			}
		</style>
	<?php
	}
}
endif;
