<?php if ( get_header_image() ) : ?>
	<a href="<?php echo esc_url( home_url( '/' ) ); ?>" id="custom-header" rel="home">
		<img src="<?php esc_url(header_image()); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="<?php echo esc_attr(get_bloginfo( 'title' )); ?>">
	</a>	
<?php endif;  ?>
<!-- Header Area -->
	<?php 
		$stickyheader = esc_attr(babytoysstore_sticky_menu());
	?>
<div class="main">
    <header class="main-header site-header <?php echo esc_attr(babytoysstore_sticky_menu()); ?>">
		<div class="announcement-bar">
			<li>
				<h3><?php echo esc_html(get_theme_mod('topheader_annoucementbartext')); ?>
					<a href="<?php echo esc_html(get_theme_mod('topheader_btnlink')); ?>">
						<?php esc_html_e('SHOP NOW','baby-toys-store'); ?>
					</a>
				</h3>
			</li>
			<li>
				<h3><?php echo esc_html(get_theme_mod('topheader_annoucementbartext')); ?>
					<a href="<?php echo esc_html(get_theme_mod('topheader_btnlink')); ?>">
						<?php esc_html_e('SHOP NOW','baby-toys-store'); ?>
					</a>
				</h3>
			</li>
			<li>
				<h3><?php echo esc_html(get_theme_mod('topheader_annoucementbartext')); ?>
					<a href="<?php echo esc_html(get_theme_mod('topheader_btnlink')); ?>">
						<?php esc_html_e('SHOP NOW','baby-toys-store'); ?>
					</a>
				</h3>
			</li>
			<li>
				<h3><?php echo esc_html(get_theme_mod('topheader_annoucementbartext')); ?>
					<a href="<?php echo esc_html(get_theme_mod('topheader_btnlink')); ?>">
						<?php esc_html_e('SHOP NOW','baby-toys-store'); ?>
					</a>
				</h3>
			</li>
		</div>
		<div class="header-section">
			<div class="headfer-content">
				<div class="container">
					<div class="row m-rl">
						<div class="col-lg-3 col-md-7 col-sm-6 col-6 pd-0 logo-box">
							<div class="site-logo">
								<?php
								if(has_custom_logo())
									{	
										the_custom_logo();
									}
									else { 
								?>
								<a class="site-title" href="<?php echo esc_url( home_url( '/' ) ); ?>">	
									<?php 
										echo esc_html(bloginfo('name'));
									?>
								</a>	
								<?php 						
									}
								?>
							</div>
							<div class="box-info">
								<?php
									$babytoysstore_site_desc = get_bloginfo( 'description');
									if ($babytoysstore_site_desc) : ?>
										<p class="site-description"><?php echo esc_html($babytoysstore_site_desc); ?></p>
								<?php endif; ?>
							</div>
						</div>
						<div class="col-lg-7 col-md-2 col-sm-2 col-2 menu">
								<button class="toggle nav-toggle mobile-nav-toggle" data-toggle-target=".menu-modal"  data-toggle-body-class="showing-menu-modal" aria-expanded="false" data-set-focus=".close-nav-toggle">
									<span class="toggle-inner">
										<span class="toggle-icon">
											<i class="fa fa-bars"></i>
										</span>
									</span>
								</button><!-- .nav-toggle -->
								<div class="header-navigation-wrapper">

								<?php
								if ( has_nav_menu( 'primary_menu' ) || ! has_nav_menu( 'expanded' ) ) {
								?>

									<nav class="primary-menu-wrapper" aria-label="<?php echo esc_attr_x( 'Horizontal', 'menu', 'baby-toys-store' ); ?>">

										<ul class="primary-menu reset-list-style">

										<?php
										if ( has_nav_menu( 'primary_menu' ) ) {

											wp_nav_menu(
												array(
													'container'  => '',
													'items_wrap' => '%3$s',
													'theme_location' => 'primary_menu',
												)
											);

										} elseif ( ! has_nav_menu( 'expanded' ) ) {

											wp_list_pages(
												array(
													'match_menu_classes' => true,
													'show_sub_menu_icons' => true,
													'title_li' => false,
													'walker'   => new BabyToysStore_Walker_Page(),
												)
											);

										}
										?>
										</ul>
									</nav><!-- .primary-menu-wrapper -->

								<?php } ?>
								</div><!-- .header-navigation-wrapper -->
								<?php
								// Output the menu modal.
								get_template_part( 'template-parts/sections/modal-menu' );
								?>
						</div>
						<div class="col-lg-2 col-md-3 col-sm-4 col-4 pd-0 mb-n">
								<div class="hbtn">
									<a class="btn" href="<?php echo esc_html(get_theme_mod('topheader_btnlink')); ?>"><?php esc_html_e('Contact Now','baby-toys-store'); ?></a>
								</div>
						</div>
					</div>
				</div>
			</div>
			<div class="container">
				<div class="btm-head row">
					<div class="col-xl-2 col-lg-2 col-md-3 col-sm-3 col-3 pd-0">
						<div class="header-category-box ">							
							<button class="product-btn">
								<li><i class="fa fa-th-large" aria-hidden="true"></i> </li><li class="hcattxt"> <?php echo esc_html_e('New Arrival','baby-toys-store'); ?></li>
							</button>
							<div class="product-cat" style="display: none">
								<?php
								$args = array(
									'number'     => 0,
									'orderby'    => 'title',
									'order'      => 'ASC',
									'hide_empty' => false,
								);

								$product_categories = get_terms('product_cat', $args);

								if (!is_wp_error($product_categories)) {
									$count = count($product_categories);

									if ($count > 0) {
										foreach ($product_categories as $product_category) {
											$cat_id = $product_category->term_id;
											$cat_link = get_category_link($cat_id);

											if ($product_category->category_parent == 0) { ?>
												<li class="drp_dwn_menu">
													<a href="<?php echo esc_url(get_term_link($product_category)); ?>">
														<?php echo esc_html($product_category->name); ?>
													</a>
												</li>
											<?php
											}
										}
									}
								} else {
									echo '<p>' . esc_html__('No product categories found.', 'baby-toys-store') . '</p>';
								}
								?>
							</div>
						</div>
					</div> 
					<div class="col-xl-7 col-lg-6 col-md-4 col-sm-9 col-9 pd-0 fm-dec">
						<?php if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { ?>
							<?php //this prints out your search form 
								get_search_form(); 
							?>
							<div class="clearfix"></div>
						<?php } ?>
					</div>
					<div class="col-xl-3 col-lg-4 col-md-5 col-sm-12 col-12 pd-0 store-btn">
						<?php if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { ?>

						<li>
							<a class="h-cart" href="<?php if(function_exists('wc_get_cart_url')){ echo esc_url(wc_get_cart_url()); } ?>" >
								<i class="fa fa-shopping-bag" ></i>
								<?php 
									
									$count = WC()->cart->cart_contents_count;
									$cart_url = wc_get_cart_url();
									if ( $count > 0 ) {
									?>
										<span><?php echo esc_html( $count ); ?></span>
									<?php 
									}
									else {
										?>
										<span><?php echo esc_html_e('0','baby-toys-store'); ?></span>
										<?php 
									}
									
								?>
							</a>
						</li>
						<?php } ?>
						<li>
							<a class="acc" href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>">
								<i class="fa fa-user" ></i>
							</a>
						</li>
						<li>
							<a class="location-btn" href="<?php echo esc_html(get_theme_mod('topheader_storelocation_btnlink')); ?>">
								<i class="fa fa-map-marker" ></i>
								<?php esc_html_e('Store Location','baby-toys-store'); ?>
							</a>
						</li>
					</div>
				</div>
			</div>
		</div>

    </header>
	<div class="clearfix"></div>
</div>

