<?php global $wp_query;
$theme_options = _WSH()->option(); ?>


<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>

	<!-- Meta UTF8 charset -->
	<meta charset="utf-8">
	
	<!-- Viewport specification for mobile devices -->
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<?php if( $favicon = sh_set($theme_options, 'site_favicon') ): ?>
		<link rel="shortcut icon" href="<?php echo esc_url( $favicon );?>" type="image/x-icon" />
	<?php endif; ?>
	

	<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
	<!--[if lt IE 9]>
		<script src="<?php echo get_template_directory_uri(); ?>/js/plugins/html5shiv.js"></script>
		<script src="<?php echo get_template_directory_uri(); ?>/js/plugins/respond.js"></script>
	<![endif]-->
 
	<?php wp_head(); ?>

</head>

<?php $body_class = ( is_front_page() && is_page() ) ? '' : 'single-page'; 
$body_class = ( $wp_query->is_posts_page ) ? 'single-page' : $body_class;?>

<body <?php body_class($body_class); ?>>  
	
	<!-- #Preloader -->
	<div id="preloader"></div>
	<!-- / #Preloader -->
	
	<!-- #wrap -->
	<div id="wrap">
	
		<?php //printr($theme_options);
		$menu_pos = sh_set( $_GET, 'menu' ) ? sh_set( $_GET, 'menu' ) : sh_set( $theme_options, 'menu_poosition' ); 
		if( $menu_pos == 'below'): ?>
			<!-- Hero -->
			<div id="hero">
				<div class="banner">
					<?php $slider = sh_set( $theme_options, 'rev_slider');
					echo do_shortcode('[rev_slider '.$slider.']'); ?>
				</div>
			</div>
		<?php endif; ?>
		
		<!-- Navigation -->
		<nav class="navbar fixed-enabled" role="navigation">
			<div class="container">

				<div class="navbar-header">
					<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
						<span class="sr-only">Toggle navigation</span>
						<span class="fa fa-bars"></span>
					</button>
					<?php $logo_type = sh_set( $theme_options, 'logo_type', 'image' );
					  
					  if( $logo_type == 'text' )
					  {
						  //printr($theme_options);
						  $LogoStyle = sh_get_font_settings( array( 'logo_font_size' => 'font-size', 'logo_font_face' => 'font-family', 'logo_font_style' => 'font-style', 'logo_color' => 'color' ), ' style="', '"' );
						  $Logo = '<span>'.sh_set( $theme_options, 'logo_heading', get_bloginfo('name')).'</span>';
					  }
					  else
					  {
					  	  $height = (get_custom_header()->height) ? ' height="'.get_custom_header()->height.'"' : '';
					  	  $width = ( get_custom_header()->width ) ? ' width="'.get_custom_header()->width.'"' : '';
					  	  $LogoStyle = '';
						  $Logo = '<img src="'.get_header_image().'"'.$height.$width.' alt="'.get_bloginfo('name').'" />';
					  }
					  ?>
					  
					  <a class="navbar-brand h1 uppercase" href="<?php echo esc_url( home_url() ); ?>" title="<?php bloginfo('name'); ?>"<?php echo esc_attr($LogoStyle);?>>
						  <?php echo balanceTags( $Logo );?>
						  <?php if( $slogan_heading = sh_set( $theme_options, 'slogan_heading' ) ): ?>
							<?php if( $logo_type == 'text' ): ?>
								<p><?php echo balanceTags( $slogan_heading ); ?></p>
							<?php endif; ?>
						  <?php endif; ?>
					  </a>

				</div>  <!-- / .navbar-header -->

				<div class="navbar-text navbar-right search-trigger visible-md visible-lg">
					<a id="search-trigger" href="javascript:void(0)"><i class="fa fa-search"></i></a>
				</div> <!-- / .search-trigger -->

				<div class="search-container">
					<form action="<?php echo home_url(); ?>" method="get">
						<input type="text" name="s" placeholder="Search">
						<a class="close" href="javascript:void(0)"><i class="fa fa-times"></i></a>
					</form>
				</div>  <!-- / .search-container -->

				<?php $count = 0;
				$meta = _WSH()->get_meta(); ?>

				<div class="collapse navbar-collapse">
					<ul class="nav navbar-nav navbar-right">

						<?php //if( (is_home() || is_front_page()) && !$wp_query->is_posts_page ){
						if( true ) {
                            
                            echo '<li><a href="#hero">'.esc_html__('Home', SH_NAME).'</a></li>';
                                                        
                            foreach( (array)sh_set( $meta, 'single_pages' ) as $pages ){ 
                                $count = $count + 1;
                                //if( $count == 1 ) continue;
                                $title = get_the_title( $pages );
                                $li_class = ( $count == 1 ) ? ' class="no-icon-item"' : '';
                                echo '<li><a href="#section'.esc_attr($pages).'">'.balanceTags($title).'</a></li>';
                                
                            }
                        }else {
                            $ref = sh_set($_SERVER, 'HTTP_REFERER');
                            if( $ref )
                            echo '<li><a href="'.esc_url($ref).'">'.esc_html__('Back', SH_NAME).'</a></li>';
                            else 
                            echo '<li><a href="'.esc_url(home_url()).'">'.esc_html__('Back', SH_NAME).'</a></li>';
                        } ?>
                    </ul>
                </div>
			</div>
		</nav>

		
		<?php if( $menu_pos == 'above'): ?>
			<!-- Hero -->
			<div id="hero">
				<div class="banner">
					<?php $slider = sh_set( $theme_options, 'rev_slider');
					echo do_shortcode('[rev_slider '.$slider.']'); ?>
				</div>
			</div>
		<?php endif; ?>
