<?php
// Do not allow direct access to the file.
if( ! defined( 'ABSPATH' ) ) {
    exit;
}
/**
 * Header Top
 *
 */
function live_news_header () {
?>
<?php if ( !get_theme_mod( 'activate_header_top' ) ) { ?>
	<div class="header-top">
<?php if ( !get_theme_mod( 'activate_header_top' ) ) { ?>			
			<div id="live-time">
			<?php if ( !get_theme_mod( 'activate_header_date' )  or get_theme_mod( 'live_news_active_social' ) ) { ?>	
			    <span class="dashicons dashicons-calendar-alt"> </span> 
			    <span id="live-date"><?php echo esc_html( date_i18n('F d, Y', false) ); ?></span>
			<?php } ?>
			<?php if ( !get_theme_mod( 'activate_header_clock' ) ) { ?>	
				<div id="live-clock">
					<div id="live-time">
						<span id="live-hours"><?php esc_html_e('11', 'live-news'); ?></span>
						<span id="live-minutes"><?php esc_html_e('11', 'live-news'); ?></span>
						<span id="live-seconds"><?php esc_html_e('11', 'live-news'); ?></span>
						<span id="live-phase"><?php esc_html_e('AM', 'live-news'); ?></span>
					</div>
				</div>
			<?php } ?>
			</div>
			
			<?php 
			if( !get_theme_mod( 'activate_header_sticky' ) ) { echo live_news_marquee_vert (); }
     }
			if ( get_theme_mod( 'live_news_active_social' ) ) { live_news_social_section (); } ?>
		
	</div>
<?php


}
?>
<div id="mobile-grid" class="grid-top">
	<!-- Site Navigation  -->
	<button id="s-button-menu" class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><img src="<?php echo esc_url(get_template_directory_uri() ) . '/images/mobile.jpg'; ?>"/></button>
		<div class="mobile-setiles">
		<?php
		do_action( 'live_news_header_search_top_mobile' );
		do_action( 'live_news_header_woo_cart' );
		?>
	</div>	
	<nav id="site-navigation-mobile" class="main-navigation" role="navigation">
		<button class="menu-toggle"><?php esc_html_e( 'Menu', 'live-news' ); ?></button>
		<?php wp_nav_menu( array( 
		'theme_location' => 'primary',
		'menu_id' => 'primary-menu',	
		) ); ?>
	</nav><!-- #site-navigation -->
</div>
<header id="masthead" class="site-header" itemscope="itemscope" itemtype="http://schema.org/WPHeader">

	<!-- Header Image  -->
	<div class="all-header">
	    <div class="s-shadow"></div>
	    <div class="s-hidden">
			<?php if (get_theme_mod( 'header_image_position' ) == 'default' ) { ?>
			<img id="masthead" style="<?php live_news_heade_image_zoom_speed (); ?>" class="header-image" src='<?php echo esc_url(get_template_directory_uri() ) . '/images/header.jpg'; ?>' alt="<?php esc_attr_e( 'header image','live-news' ); ?>"/>	
			<?php } ?>
			<?php if (get_theme_mod( 'header_image_position' ) == 'real' ) { ?>
			<img id="masthead" style="<?php live_news_heade_image_zoom_speed (); ?>" class="header-image" src='<?php if ( !is_home() and has_post_thumbnail() and get_theme_mod( 'live_news_header_featured' ) ) { the_post_thumbnail_url(); } else { header_image(); } ?>' alt="<?php esc_attr_e( 'header image','live-news' ); ?>"/>	
			<?php } else { ?>
			<div id="masthead" class="header-image" style="<?php live_news_heade_image_zoom_speed (); ?> background-image: url( '<?php if (  !is_home() and has_post_thumbnail() and get_theme_mod( 'live_news_header_featured' ) ) { the_post_thumbnail_url(); } else { header_image(); } ?>' );"></div>
			<?php } ?>
		</div>
		<div class="site-branding">
		
		<?php if ( display_header_text() == true ) { 
			
			if ( is_front_page() && is_home() ) :
			
			if ( has_custom_logo() ) { ?>
				<div class="header-logo" itemprop="logo" itemscope="itemscope" itemtype="http://schema.org/Brand">
						<?php the_custom_logo(); ?>
				</div>			
		<?php } else { ?>
					<h1 class="site-title" itemscope itemtype="http://schema.org/Brand"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><span class="ml2"><?php bloginfo( 'name' ); ?></span></a></h1>
					<?php
				}
				else :
				if ( has_custom_logo() ) { ?>
					<div class="header-logo" itemprop="logo" itemscope="itemscope" itemtype="http://schema.org/Brand">
							<?php the_custom_logo(); ?>
					</div>			
				<?php } else { ?>

					<p class="site-title" itemscope itemtype="http://schema.org/Brand"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><span class="ml2"><?php bloginfo( 'name' ); ?></span></a></p>
					
					<?php
				}
				endif;
				$live_news_description = esc_html(get_bloginfo( 'description', 'display' ) );
				if ( $live_news_description || is_customize_preview() ) :
					?>    
					<p class="site-description" itemprop="headline">
						<span class="ml2"><?php echo esc_html($live_news_description); ?></span>
					</p>

				<?php endif; ?>	
		<?php } ?>	
		</div>
		<!-- .site-branding -->
		<?php if ( get_theme_mod( 'advertise_top' ) ) { ?>
		<a <?php if( get_theme_mod( 'advertise_top_link_type' ) == "new" ) { echo "target='_blank'"; } ?> href="<?php echo esc_url( get_theme_mod( 'advertise_top_url' ) ); ?>">
			<div class="top-adv">
				<img src="<?php echo esc_url( get_theme_mod( 'advertise_top' ) ); ?>" />
			</div>
		</a>
		<?php } ?>
		
	</div>

</header>
	<div id="grid-top" class="grid-top">
		<nav id="site-navigation" class="main-navigation" role="navigation">
			<?php wp_nav_menu( array( 
			'theme_location' => 'primary',
			'menu_id' => 'primary-menu',
			'items_wrap' => '
			<ul id="%1$s" class="%2$s">%3$s 
				'.do_action( 'live_news_header_search_top' )
				.do_action( 'live_news_header_woo_cart' ).'
			</ul>'		
			) ); ?>
		</nav><!-- #site-navigation -->

	</div>
	
	<?php 
	if ( ( is_front_page()  ) and !get_theme_mod( 'show_marquee' ) ) { echo live_news_marquee (); }
	if ( ( !is_front_page()  ) and !get_theme_mod( 'show_marquee_all' ) ) { echo live_news_marquee (); }
}