<?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 Shoes Footwear
 */

/**
 * Set up the WordPress core custom header feature.
 *
 * @uses shoes_footwear_header_style()
 */
function shoes_footwear_custom_header_setup() {
	add_theme_support( 'custom-header', apply_filters( 'shoes_footwear_custom_header_args', array(
		'default-image'          => '',
		'width'                  => 1200,
		'height'                 => 100,
		'flex-height'            => true,
		'flex-width'             => true,
		'wp-head-callback'       => 'shoes_footwear_header_style',
	) ) );

	// Register default headers.
	register_default_headers( array(
		'default-banner' => array(
			'url'           => '%s/images/default-header.png',
			'thumbnail_url' => '%s/images/default-header.png',
			'description'   => esc_html_x( 'Default Banner', 'header image description', 'shoes-footwear' ),
		),

	) );
}
add_action( 'after_setup_theme', 'shoes_footwear_custom_header_setup' );

function shoes_footwear_header_style() {

	$shoes_footwear_header_text_color = get_header_textcolor();

	if ( get_theme_support( 'custom-header', 'default-text-color' ) === $shoes_footwear_header_text_color ) {
		return;
	}

	if ( ! display_header_text() ) :

		echo '<style>
		.site-title,
		.site-description{
			position:absolute;
			clip:rect(1px,1px,1px,1px);
		}
		</style>';

	else :

		echo '<style>
		.site-title a,
		.site-description{
			color:#' . esc_attr( $shoes_footwear_header_text_color ) . ' !important;
		}
		</style>';

	endif;
}