<?php
/**
 * The header for our theme
 *
 * This is the template that displays all of the <head> section and everything up until <div id="content">
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package elegant_recipe_blog
 */

$elegant_recipe_blog_options = elegant_recipe_blog_theme_options();
$facebook = $elegant_recipe_blog_options['facebook'];
$twitter = $elegant_recipe_blog_options['twitter'];
$instagram = $elegant_recipe_blog_options['instagram'];
$youtube = $elegant_recipe_blog_options['youtube'];
$pinterest = $elegant_recipe_blog_options['pinterest'];

$email = $elegant_recipe_blog_options['email'];

$header_search = $elegant_recipe_blog_options['search_show'];

?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo('charset'); ?>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="profile" href="https://gmpg.org/xfn/11">

	<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>

<?php if(get_option('elegant-blog_free_back_top_top_enable') && get_option('elegant-blog_free_back_top_top_enable') == "on" ){ ?>
<!-- Back to top -->
<div id="back-to-top" title="Go to top">
  <i class="fa fa-arrow-up" aria-hidden="true"></i>
</div>
<?php }?>
<?php wp_body_open(); ?>


<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e(
     'Skip to content',
     'elegant-recipe-blog'
 ); ?></a>

<?php 
		$image_src = get_header_image();

			if (!empty($image_src)) {
				$image_style =
					"style='background-image:url(" . esc_url($image_src) . ")'"; ?>
				<?php
			} else {
				$image_style = '';
			}
		?>

<div class="main-wrap">
	<header id="masthead" class="site-header big-header">
	<div class="bottom-header">


<div class="container">
	<div class="row">

	<div class="header-social">
				        	
							<ul> <?php
		   if ($facebook) {
			   echo '<a class="social-btn facebook" href="' .
				   esc_url($facebook) .
				   '"><i class="fa-brands fa-facebook-f" aria-hidden="true"></i></a>';
		   }
	
		   if ($twitter) {
			   echo '<a class="social-btn twitter" href="' .
				   esc_url($twitter) .
				   '"><i class="fa-brands fa-x-twitter" aria-hidden="true"></i></a>';
		   }
		   if ($instagram) {
			echo '<a class="social-btn instagram" href="' .
				esc_url($instagram) .
				'"><i class="fa-brands fa-instagram" aria-hidden="true"></i></a>';
		}
		if ($youtube) {
		 echo '<a class="social-btn youtube" href="' .
			 esc_url($youtube) .
			 '"><i class="fa-brands fa-youtube" aria-hidden="true"></i></a>';
	 }
	 if ($pinterest) {
		 echo '<a class="social-btn pinterest" href="' .
			 esc_url($pinterest) .
			 '"><i class="fa-brands fa-pinterest-p" aria-hidden="true"></i></a>';
	 }
	 
	 if ($email) {
		 echo '<a class="social-btn email" href="mailto:' .
			 esc_html__($email) .
			 '"><i class="fa-regular fa-envelope" aria-hidden="true"></i></a>';
	 }
	
?>
								</ul>
							</div>

	<div class="site-branding">
			<?php the_custom_logo(); ?>
			<div class="logo-wrap">

			<?php
if (is_front_page() && is_home()): ?>
				<h2 class="site-title"><a href="<?php echo esc_url(
home_url('/')
); ?>" rel="home"><?php bloginfo('name'); ?></a></h2>
				<?php else: ?>
				<h2 class="site-title"><a href="<?php echo esc_url(
home_url('/')
); ?>" rel="home"><?php bloginfo('name'); ?></a></h2>
				<?php endif;
$elegant_recipe_blog_description = get_bloginfo('description', 'display');
if ($elegant_recipe_blog_description || is_customize_preview()): ?>
				<p class="site-description"><?php echo $elegant_recipe_blog_description;
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?></p>
			<?php endif;
?>
			</div>
		</div><!-- .site-branding -->
	
		<?php if ($header_search): ?>
							<div class="header-search">
							<?php get_search_form(); ?>
							</div>
						<?php endif; ?>

	</div>
</div>
</div>
	<div class="header-top">
			<div class="container">
	             <div class="row">



					<div class="col-md-12">
					<div class="collapse navbar-collapse" id="navbar-collapse">
		            	<nav id="site-navigation" class="main-navigation clearfix">
		             <?php if (has_nav_menu('primary')) { ?>
		                <?php wp_nav_menu([
                      'theme_location' => 'primary',
                      'container' => '',
                      'menu_class' => 'nav navbar-nav navbar-center nav-menu',
                      'menu_id' => 'menu-main',
                      'walker' => new elegant_recipe_blog_nav_walker(),
                      'fallback_cb' => 'elegant_recipe_blog_nav_walker::fallback',
                  ]); ?>
		            	</nav>
		                <?php } else { ?>
		                    <nav id="site-navigation" class="main-navigation clearfix">
		                        <?php wp_page_menu([
                              'menu_class' => 'menu',
                              'menu_id' => 'menuid',
                          ]); ?>
		                    </nav>
		                <?php } ?>

		            </div><!-- End navbar-collapse -->
					</div>




		            
				</div>
			</div>
		</div>







	</header><!-- #masthead -->

	<div class="header-mobile">
		<div class="site-branding">
			<?php the_custom_logo(); ?>
			<div class="logo-wrap">

			<?php
   if (is_front_page() && is_home()): ?>
				<h2 class="site-title"><a href="<?php echo esc_url(
        home_url('/')
    ); ?>" rel="home"><?php bloginfo('name'); ?></a></h2>
				<?php else: ?>
				<h2 class="site-title"><a href="<?php echo esc_url(
        home_url('/')
    ); ?>" rel="home"><?php bloginfo('name'); ?></a></h2>
				<?php endif;
   $elegant_recipe_blog_description = get_bloginfo('description', 'display');
   if ($elegant_recipe_blog_description || is_customize_preview()): ?>
				<p class="site-description"><?php echo $elegant_recipe_blog_description;
       ?></p>
			<?php endif;
   ?>
			</div>
		</div><!-- .site-branding -->


		<div class="mobile-wrap">
	        <div class="header-social">

			<ul> <?php
        if ($facebook) {
			echo '<a class="social-btn facebook" href="' .
				esc_url($facebook) .
				'"><i class="fa-brands fa-facebook-f" aria-hidden="true"></i></a>';
		}
 
		if ($twitter) {
			echo '<a class="social-btn twitter" href="' .
				esc_url($twitter) .
				'"><i class="fa-brands fa-x-twitter" aria-hidden="true"></i></a>';
		}
		if ($instagram) {
		 echo '<a class="social-btn instagram" href="' .
			 esc_url($instagram) .
			 '"><i class="fa-brands fa-instagram" aria-hidden="true"></i></a>';
	 }
	 if ($youtube) {
	  echo '<a class="social-btn youtube" href="' .
		  esc_url($youtube) .
		  '"><i class="fa-brands fa-youtube" aria-hidden="true"></i></a>';
  }
  if ($pinterest) {
	  echo '<a class="social-btn pinterest" href="' .
		  esc_url($pinterest) .
		  '"><i class="fa-brands fa-pinterest-p" aria-hidden="true"></i></a>';
  }
  
  if ($email) {
	  echo '<a class="social-btn email" href="mailto:' .
		  esc_html__($email) .
		  '"><i class="fa-regular fa-envelope" aria-hidden="true"></i></a>';
  }
 


       ?>
			                </ul>
			</div>
	   <div id="mobile-menu-wrap">
	   <button class="open-menu"><i class="fa fa-bars" aria-hidden="true"></i></button>

	        <div class="collapse navbar-collapse" id="navbar-collapse1">

	         <?php if (has_nav_menu('primary')) { ?>
	            <?php wp_nav_menu([
                 'theme_location' => 'primary',
                 'container' => '',
                 'menu_class' => 'nav navbar-nav navbar-center',
                 'menu_id' => 'menu-main',
                 'walker' => new elegant_recipe_blog_nav_walker(),
                 'fallback_cb' => 'elegant_recipe_blog_nav_walker::fallback',
             ]); ?>
	            <?php } else { ?>
	                <nav id="site-navigation" class="main-navigation clearfix">
	                    <?php wp_page_menu([
                         'menu_class' => 'menu',
                         'menu_id' => 'menuid',
                     ]); ?>
	                </nav>
	            <?php } ?>

				<div class="header-search-form">
					<?php if ($header_search) {
         echo get_search_form();
     } ?>
		        </div>
		        <button class="close-menu"><span class="sr-text"><?php echo esc_html__(
                 'Close Menu',
                 'elegant-recipe-blog'
             ); ?></span><i class="fa fa-times" aria-hidden="true"></i></button>	
				</div>
		    
	        </div><!-- End navbar-collapse -->
	    </div>
	</div>
	<!-- /main-wrap -->
	<div class="breadcrumbs ">
			<div class="container">
                <?php if (function_exists('check_breadcrumb')) check_breadcrumb();   ?>
            </div>
		</div>