<?php
/**
 * @package Jungle Safari
 * @subpackage jungle-safari
 * @since jungle-safari 1.0
 * Setup the WordPress core custom header feature.
 * @uses jungle_safari_header_style()
*/

function jungle_safari_custom_header_setup() {

	add_theme_support( 'custom-header', apply_filters( 'jungle_safari_custom_header_args', array(
		'default-text-color'     => 'fff',
		'header-text' 			 =>	false,
		'width'                  => 1920,
		'height'                 => 300,
		'flex-width'         	=> true,
        'flex-height'        	=> true,
		'wp-head-callback'       => 'jungle_safari_header_style',
	) ) );
}

add_action( 'after_setup_theme', 'jungle_safari_custom_header_setup' );

if ( ! function_exists( 'jungle_safari_header_style' ) ) :

add_action( 'wp_enqueue_scripts', 'jungle_safari_header_style' );
function jungle_safari_header_style() {
	$jungle_safari_header_image = get_header_image() ? get_header_image() : get_template_directory_uri() . '/images/header-image.png';
	$jungle_safari_custom_css = "
        .banner-image-box .top-header-img{
			background-image:url('" . esc_url($jungle_safari_header_image) . "');
			background-repeat: no-repeat;
	        background-position: center center;
	        background-size: cover !important;
	        height: 300px;
		}";
	   	wp_add_inline_style( 'jungle-safari-basic-style', $jungle_safari_custom_css );
}
endif;