<?php
/**
 * The template part for Middle Header
 *
 * @package Christmas Holiday
 * @subpackage christmas-holiday
 * @since christmas-holiday 1.0
 */
?>

<div class="middle-header <?php if( get_theme_mod( 'christmas_holiday_sticky_header', false) == 1 || get_theme_mod( 'christmas_holiday_stickyheader_hide_show', false) == 1) { ?> header-sticky"<?php } else { ?>close-sticky <?php } ?>">
  <div class="container">
    <div class="row">
      <div class="col-lg-4 col-md-4 col-8 text-lg-start text-md-start text-start align-self-center">
        <div class="logo">
          <?php if ( has_custom_logo() ) : ?>
            <div class="site-logo"><?php the_custom_logo(); ?></div>
          <?php endif; ?>
          <?php $blog_info = get_bloginfo( 'name' ); ?>
            <?php if ( ! empty( $blog_info ) ) : ?>
              <?php if ( is_front_page() && is_home() ) : ?>
                <?php if( get_theme_mod('christmas_holiday_logo_title_hide_show',true) == 1){ ?>
                  <p class="site-title mb-0"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                <?php } ?>
              <?php else : ?>
                <?php if( get_theme_mod('christmas_holiday_logo_title_hide_show',true) == 1){ ?>
                  <p class="site-title mb-0"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                <?php } ?>
              <?php endif; ?>
            <?php endif; ?>
            <?php
              $description = get_bloginfo( 'description', 'display' );
              if ( $description || is_customize_preview() ) :
            ?>
            <?php if( get_theme_mod('christmas_holiday_tagline_hide_show',false) == 1){ ?>
              <p class="site-description mb-0">
                <?php echo esc_html($description); ?>
              </p>
            <?php } ?>
          <?php endif; ?>
        </div>
      </div>
      <div class="col-lg-5 col-md-3 col-4 align-self-center mb-lg-0 mb-md-0 mb-2">
        <?php get_template_part('template-parts/header/navigation'); ?>
      </div>
      <div class="col-lg-3 col-md-5 col-12 align-self-center text-lg-end text-md-end text-center my-lg-0 my-md-0 my-3">
        <?php if(class_exists('woocommerce')){ ?>
            <span class="wishlist me-3">
                <?php if(defined('YITH_WCWL')){ ?>
                  <a class="wishlist_view position-relative" href="<?php echo YITH_WCWL()->get_wishlist_url(); ?>"><i class="fas fa-heart"></i>
                  <?php $wishlist_count = YITH_WCWL_Wishlists()->count_items_in_wishlist(); ?>
                  <?php echo esc_html( $wishlist_count ); ?></a>
                <?php }?>
            </span>
            <span class="cart_no me-3">
              <a href="<?php if(function_exists('wc_get_cart_url')){ echo esc_url(wc_get_cart_url()); } ?>" title="<?php esc_attr_e( 'shopping cart','christmas-holiday' ); ?>"><i class="fas fa-shopping-bag"></i><span class="screen-reader-text"><?php esc_html_e( 'shopping cart','christmas-holiday' );?></span></a>
            </span>
            <span class="account">
              <?php if ( is_user_logged_in() ) { ?>
                <a href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>" title="<?php esc_attr_e('My Account','christmas-holiday'); ?>"><i class="fas fa-user"></i><span class="screen-reader-text"><?php esc_html_e( 'My Account','christmas-holiday' );?></span></a>
              <?php }
              else { ?>
                <a href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>" title="<?php esc_attr_e('Login / Register','christmas-holiday'); ?>"><i class="fas fa-user"></i><span class="screen-reader-text"><?php esc_html_e( 'Login / Register','christmas-holiday' );?></span></a>
              <?php } ?>
            </span>
        <?php }?>
      </div>
    </div>
  </div>
</div>