<?php
/**
 * Sample implementation of the Custom Header feature
 *
 * @link https://developer.wordpress.org/themes/functionality/custom-headers/
 *
 * @package online_school_courses
 */

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

add_action( 'after_setup_theme', 'online_school_courses_custom_header_setup' );

if ( ! function_exists( 'online_school_courses_header_style' ) ) :

add_action( 'wp_enqueue_scripts', 'online_school_courses_header_style' );
function online_school_courses_header_style() {
	if ( get_header_image() ) :
	$online_school_courses_custom_css = "
            .bottom-header-outer-wrapper, header.site-header .header-main-wrapper .bottom-header-outer-wrapper .bottom-header-part, header.site-header .header-main-wrapper .bottom-header-outer-wrapper .bottom-header-part .bottom-header-part-wrapper.hello.sticky-header.is-sticky {
			background-image:url('".esc_url(get_header_image())."') !important;
			background-position: center top;
			background-size: cover !important;
		}";
	   	wp_add_inline_style( 'online-school-courses-style', $online_school_courses_custom_css );
	endif;
}
endif;