<?php
/**
 * @package Handyman Cleaner
 * @subpackage handyman-cleaner
 * @since handyman-cleaner 1.0
 * Setup the WordPress core custom header feature.
 * @uses handyman_cleaner_header_style()
*/

function handyman_cleaner_custom_header_setup() {

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

add_action( 'after_setup_theme', 'handyman_cleaner_custom_header_setup' );

if ( ! function_exists( 'handyman_cleaner_header_style' ) ) :

add_action( 'wp_enqueue_scripts', 'handyman_cleaner_header_style' );
function handyman_cleaner_header_style() {
	if ( get_header_image() ) :
	$handyman_cleaner_custom_css = "
        .page-template-home-page .topbar, .topbar{
			background-image:url('".esc_url(get_header_image())."');
			background-position: center top;
			background-size: cover;
		}";
	   	wp_add_inline_style( 'handyman-cleaner-basic-style', $handyman_cleaner_custom_css );
	endif;
}
endif;