<?php
/**
 * @package Swimming Pool Cleaning
 * @subpackage swimming-pool-cleaning
 * @since swimming-pool-cleaning 1.0
 * Setup the WordPress core custom header feature.
 * @uses swimming_pool_cleaning_header_style()
*/

function swimming_pool_cleaning_custom_header_setup() {

	add_theme_support( 'custom-header', apply_filters( 'swimming_pool_cleaning_custom_header_args', array(
		'default-text-color'     => 'fff',
		'header-text' 			 =>	false,
		'width'                  => 1400,
		'height'                 => 70,
		'flex-width'         	=> true,
        'flex-height'        	=> true,
		'wp-head-callback'       => 'swimming_pool_cleaning_header_style',
	) ) );
}

add_action( 'after_setup_theme', 'swimming_pool_cleaning_custom_header_setup' );

if ( ! function_exists( 'swimming_pool_cleaning_header_style' ) ) :

add_action( 'wp_enqueue_scripts', 'swimming_pool_cleaning_header_style' );
function swimming_pool_cleaning_header_style() {
	if ( get_header_image() ) :
	$swimming_pool_cleaning_custom_css = "
        .middle-header{
			background-image:url('".esc_url(get_header_image())."');
			background-position: center top;
			background-size: cover;
		}";
	   	wp_add_inline_style( 'swimming-pool-cleaning-basic-style', $swimming_pool_cleaning_custom_css );
	endif;
}
endif;