<?php
/**
 * @package Affiliate Marketing Business
 * @subpackage affiliate-marketing-business
 * @since affiliate-marketing-business 1.0
 * Setup the WordPress core custom header feature.
 * @uses affiliate_marketing_business_header_style()
*/

function affiliate_marketing_business_custom_header_setup() {

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

add_action( 'after_setup_theme', 'affiliate_marketing_business_custom_header_setup' );

if ( ! function_exists( 'affiliate_marketing_business_header_style' ) ) :

add_action( 'wp_enqueue_scripts', 'affiliate_marketing_business_header_style' );
function affiliate_marketing_business_header_style() {
	if ( get_header_image() ) :
	$affiliate_marketing_business_custom_css = "
        .top-header{
			background-image:url('".esc_url(get_header_image())."');
			background-position: center top;
			background-size: cover;
		}";
	   	wp_add_inline_style( 'affiliate-marketing-business-basic-style', $affiliate_marketing_business_custom_css );
	endif;
}
endif;