<?php
	$electromix_blog_setting_hs 	= get_theme_mod('blog_setting_hs','1');
	$electromix_blog_ttl 			= get_theme_mod('blog_ttl');
	$electromix_blog_ttl_icon		= get_theme_mod('blog_ttl_icon','fa-list-ul');
	$electromix_blog_timer_date		= get_theme_mod('blog_timer_date','2030-12-31');	
	$electromix_blog_timer_time		= get_theme_mod('blog_timer_time','00:00');
	$electromix_blog_tab_hs			= get_theme_mod('blog_tab_hs','1');
	$electromix_blog_num			= get_theme_mod('blog_num','3');
	if($electromix_blog_setting_hs=='1'):
?>

<section id="post-section" class="post-section st-py-default filter-group">
	<div class="container">
		<div class="heading-default">
			<div class="title-container wow zoomin">
				<div class="main-title">
					<i class="fa <?php echo esc_attr($electromix_blog_ttl_icon); ?>" aria-hidden="true"></i>
					<h2><?php echo wp_kses_post($electromix_blog_ttl); ?></h2>
				</div>
				<div data-timer="<?php echo esc_attr($electromix_blog_timer_date.' '.$electromix_blog_timer_time); ?>" id="dealsofdayCountDown" class="dealsofday-timer timer-container">
					<div class="dealsofday-item">
						<div class="dealsofday-count">
							<h6 class="days">05</h6>
						</div>
						<p><?php esc_html_e('DAY','electromix'); ?></p>
					</div>
					<div class="dealsofday-item">
						<div class="dealsofday-count">
							<h6 class="hours">15</h6>
						</div>
						<p><?php esc_html_e('HOUR','electromix'); ?></p>
					</div>
					<div class="dealsofday-item">
						<div class="dealsofday-count">
							<h6 class="minutes">55</h6>
						</div>
						<p><?php esc_html_e('MIN','electromix'); ?></p>
					</div>
					<div class="dealsofday-item">
						<div class="dealsofday-count">
							<h6 class="seconds">20</h6>
						</div>
						<p><?php esc_html_e('SEC','electromix'); ?></p>
					</div>
				</div>	
			</div>
			
			<?php 
				$electromix_home_blog_categories = get_categories();
				if($electromix_blog_tab_hs=='1' && !$electromix_home_blog_categories == 0): 
			?>
			<div class="d-none d-lg-block filter-container w-50 wow zoomIn" data-wow-delay="200ms" data-wow-duration="1500ms">
				<div class="tab-filter-slider owl-carousel" data-show-item="6">
					<?php foreach ($electromix_home_blog_categories as $category) { ?>					
						<a href="javascript:void(0);" data-filter="<?php echo $category->slug; ?>"><?php echo $category->name; ?></a>
					<?php }  ?>
				</div>
			</div>
			
			<div class="d-lg-none custom-owl-nav">
				<button type="button" class="custom-prev"><i class="fa fa-chevron-left"></i></button>
				<button type="button" class="custom-next"><i class="fa fa-chevron-right"></i></button>
			</div>
			<?php endif; ?>
		</div>
		<div class="post-slider owl-carousel owl-theme">
			<?php 
				$electromix_blog_args = array( 'post_type' => 'post', 'posts_per_page' => $electromix_blog_num ) ; 	
			
				$electromix_wp_query = new WP_Query($electromix_blog_args);
				if($electromix_wp_query)
				{	
				while($electromix_wp_query->have_posts()):$electromix_wp_query->the_post();
				
				$terms = get_the_category( $post->ID, 'post' );
											
				if ( $terms && ! is_wp_error( $terms ) ) : 
					$links = array();

					foreach ( $terms as $term ) 
					{
						$links[] = $term->slug;
					}
					
					$tax = join( ' ', $links );		
				else :	
					$tax = '';	
				endif;
			
			?>
			<div class="post-item-trigger mix show <?php echo esc_attr(strtolower($tax)); ?>">
				<?php get_template_part('template-parts/content/content','page'); ?>
			</div>
			<?php endwhile; } wp_reset_postdata(); ?>
		</div>
	</div>
</section>
<?php endif; ?>