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

/**
 * Set up the WordPress core custom header feature.
 *
 * @uses dark_fitness_header_style()
 */
function dark_fitness_custom_header_setup() {

	add_theme_support( 'custom-header', apply_filters( 'dark_fitness_custom_header_args', array(
		'default-text-color'     => 'fff',
		'header-text' 			 =>	false,
		'width'                  => 1360,
		'height'                 => 110,
		'flex-width'         	=> true,
        'flex-height'        	=> true,
		'wp-head-callback'       => 'dark_fitness_header_style',
	) ) );
}

add_action( 'after_setup_theme', 'dark_fitness_custom_header_setup' );

if ( ! function_exists( 'dark_fitness_header_style' ) ) :
/**
 * Styles the header image and text displayed on the blog
 *
 * @see dark_fitness_custom_header_setup().
 */
add_action( 'wp_enqueue_scripts', 'dark_fitness_header_style' );
function dark_fitness_header_style() {
	//Check if user has defined any header image.
	if ( get_header_image() ) :
	$dark_fitness_custom_css = "
        header.site-header .header-main-wrapper .bottom-header-outer-wrapper .bottom-header-part{
			background-image:url('".esc_url(get_header_image())."') !important;
			background-position: center;
			background-size: cover !important;

		}";
	   	wp_add_inline_style( 'dark-fitness-style', $dark_fitness_custom_css );
	endif;
}
endif; // dark_fitness_header_style