<?php
/**
 * The header for our theme
 * This is the template that displays all of the <head> section and everything up until <div id="wrap">
 * 
 * @since   1.0.0
 * @author  Webnus
 */

// Don't load directly.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

$deep_free_options = deep_free_options();
$enable_responsive = deep_free_get_option( $deep_free_options, 'deep_enable_responsive', '1' );
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<?php if ( $enable_responsive ) : ?>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<?php else : ?>
		<meta name="viewport" content="width=1200,user-scalable=yes">
	<?php endif; ?>
	<link rel="profile" href="http://gmpg.org/xfn/11">
	<?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
		<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">				
	<?php endif;
	wp_head();
	?>
</head>

<?php
// -> Start the #wrap div classes
$wrap_class = 'wn-wrap ';

// Colorskin
$custom_color_skin	= deep_free_get_option( $deep_free_options, 'deep_custom_color_skin' );
$color_skin_color	= deep_free_get_option( $deep_free_options, 'deep_color_skin', 'e3e3e3' );
if ( $color_skin_color != 'e3e3e3' || $custom_color_skin ) {
	$wrap_class .= 'colorskin-custom ';
}

// Background Layout
$background_layout	= deep_free_get_option( $deep_free_options, 'deep_background_layout', 'wide' );
$wrap_class 		.= ( ( $background_layout == 'boxed-wrap' ) && ( $header_menu_type != 6 ) && ( $header_menu_type != 7 ) ) ? $background_layout . ' ' : '';
// -> End the #wrap div classes

// Toggle Toparea
$toggle_toparea_enable		= deep_free_get_option( $deep_free_options, 'deep_toggle_toparea_enable', 0 );

// News Ticker
$news_ticker				= deep_free_get_option( $deep_free_options, 'deep_news_ticker' );

// woocommerce
$woo_product_title_enable 	= deep_free_get_option( $deep_free_options, 'deep_woo_product_title_enable' );
$woo_product_title			= deep_free_get_option( $deep_free_options, 'deep_woo_product_title' );
$woo_shop_title_enable		= deep_free_get_option( $deep_free_options, 'deep_woo_shop_title_enable' );
$woo_shop_title				= deep_free_get_option( $deep_free_options, 'deep_woo_shop_title' );
?>

<body <?php body_class(); ?>>
	<!-- Start the #wrap div -->
	<div id="wrap" class="<?php echo esc_attr( $wrap_class ); ?>">

		<?php if ( $toggle_toparea_enable ) : ?>
			<section class="toggle-top-area footer-in">
				<div class="w_toparea container">
					<div class="col-md-3">
						<?php if( is_active_sidebar( 'top-area-1' ) ) dynamic_sidebar('top-area-1'); ?>
					</div>
					<div class="col-md-3">
						<?php if( is_active_sidebar( 'top-area-2' ) ) dynamic_sidebar('top-area-2'); ?>
					</div>
					<div class="col-md-3">
						<?php if( is_active_sidebar( 'top-area-3' ) ) dynamic_sidebar('top-area-3'); ?>
					</div>
					<div class="col-md-3">
						<?php if( is_active_sidebar( 'top-area-4' ) ) dynamic_sidebar('top-area-4'); ?>
					</div>
				</div>
				<a class="w_toggle" href="#"></a>
			</section>
		<?php endif;

		// Webnus Header Builder
		if ( class_exists( 'WHB' ) ) {
			WHB_Output::output();
		} else {
			?>
			<header id="webnus-header-builder" class="whb-wrap">
				<div class="whb-screen-view whb-desktop-view">
					<div class="whb-area whb-row1-area whb-content-middle">
						<div class="container">
							<div class="whb-content-wrap">
							<div class="whb-col whb-left-col">
								<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="whb-element whb-logo">
									<img class="whb-logo" src="<?php echo esc_attr( DF_URL ) . 'images/whb-logo.png'; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>">
								</a>
							</div>
							<div class="whb-col whb-right-col">
								<?php
								if ( has_nav_menu( 'deep-free-header-menu' ) ) :
									$menu_out = wp_nav_menu( array(
										'theme_location'	=> 'deep-free-header-menu',
										'container'			=> false,
										'menu_id'			=> 'nav',
										'depth'				=> '5',
										'fallback_cb'		=> 'wp_page_menu',
										'items_wrap'		=> '<ul id="%1$s" class="%2$s">%3$s</ul>',
										'echo'				=> false,
									));
									$responsive_menu_out = wp_nav_menu( array(
										'theme_location'	=> 'deep-free-header-menu',
										'container'			=> false,
										'menu_id'			=> 'responav',
										'depth'				=> '5',
										'fallback_cb'		=> 'wp_page_menu',
										'items_wrap'		=> '<ul id="%1$s" class="%2$s">%3$s</ul>',
										'echo'				=> false,
									));
								endif;
								echo '<div class="whb-responsive-menu-wrap" data-uniqid="1520058985036">
											<div class="close-responsive-nav">
												<div class="whb-menu-cross-icon"></div>
											</div>
											' . wp_kses( $responsive_menu_out, wp_kses_allowed_html( 'post' ) ) . '
										</div>';
								echo '<nav class="whb-element whb-nav-wrap">' . wp_kses( $menu_out, wp_kses_allowed_html( 'post' ) ) . '</nav>';
								?>
							</div>
							</div>
						</div>
					</div>
				</div>
				<div class="whb-screen-view whb-tablets-view">
					<div class="whb-area whb-row1-area whb-content-middle">
						<div class="container">
							<div class="whb-content-wrap">
							<div class="whb-col whb-left-col">
								<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="whb-element whb-logo">
									<img class="whb-logo" src="<?php echo esc_attr( DF_URL ) . 'images/whb-logo.png'; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>">
								</a>
							</div>
							<div class="whb-col whb-right-col">
								<div class="whb-responsive-menu-icon-wrap" data-uniqid="1520058985036">
									<div class="whb-menu-cross-icon whb-responsive-menu-icon"></div>
								</div>
							</div>
							</div>
						</div>
					</div>
				</div>
				<div class="whb-screen-view whb-mobiles-view">
					<div class="whb-area whb-row1-area whb-content-middle">
						<div class="container">
							<div class="whb-content-wrap">
							<div class="whb-col whb-left-col">
								<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="whb-element whb-logo">
									<img class="whb-logo" src="<?php echo esc_attr( DF_URL ) . 'images/whb-logo.png'; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>">
								</a>
							</div>
							<div class="whb-col whb-right-col">
								<div class="whb-responsive-menu-icon-wrap" data-uniqid="1520058985036">
									<div class="whb-menu-cross-icon whb-responsive-menu-icon"></div>
								</div>
							</div>
							</div>
						</div>
					</div>
				</div>
			</header>
			<?php
		}

		// Elementor Pro Header Builder
		if ( class_exists('Webnus_Elementor_Extentions') ) {
			$webnus_elementor = new Webnus_Elementor_Extentions;
			if ( $webnus_elementor->elementor_pro_is_active() ) {
				// Elementor Pro `header` location
				if ( elementor_theme_do_location( 'deep-elementor-header' ) ) {
					elementor_theme_do_location( 'deep-elementor-header' );
				}
			}
		}

		// News Ticker
		if( $news_ticker ) {
			get_template_part( 'parts/news-ticker' );
		}

		// Woocommerce - if woocommerce available add page headline section
		global $post;
		if ( isset( $post ) && get_post_type( $post->ID ) == 'product' ) :

			if ( function_exists( 'is_product' ) && is_product() && $woo_product_title_enable ) {
				?>
				<section id="headline">
					<div class="container">
						<h2><?php echo esc_html( $woo_product_title ); ?></h2>
					</div>
				</section>
				<?php
			}

			if ( function_exists( 'is_product'  ) && ! is_product() && $woo_shop_title_enable ) {
				?>
				<section id="headline">
					<div class="container">
						<h2><?php echo esc_html( $woo_shop_title ); ?></h2>
					</div>
				</section>
				<?php
			}

			if ( function_exists( 'is_product' ) && is_product() ) {
				?>
				<section class="single-product-wrap">
					<hr class="vertical-space">
				<?php
			} else {
				?>
				<!-- Start Page Content -->
				<section class="container">
					<hr class="vertical-space">
				<?php
			}

		endif; // end woocommerce