<?php 
if(get_theme_mod('bussinessblog_section_disable') != 'on' ){ ?>

<?php 
	if( get_theme_mod('sec_bussinessblogsectionTpadding',true) ) {
		$sec_bussinessblogsectionTpadding = 'padding-top:'.esc_attr(get_theme_mod('sec_bussinessblogsectionTpadding')).';';
	}
	if( get_theme_mod('sec_bussinessblogsectionBpadding',true) ) {
		$sec_bussinessblogsectionBpadding = 'padding-bottom:'.esc_attr(get_theme_mod('sec_bussinessblogsectionBpadding')).';';
	}
	if( get_theme_mod('sec_bussinessblogsectionLpadding',true) ) {
		$sec_bussinessblogsectionLpadding = 'padding-left:'.esc_attr(get_theme_mod('sec_bussinessblogsectionLpadding')).';';
	}
	if( get_theme_mod('sec_bussinessblogsectionRpadding',true) ) {
		$sec_bussinessblogsectionRpadding = 'padding-right:'.esc_attr(get_theme_mod('sec_bussinessblogsectionRpadding')).';';
	}
	if( get_theme_mod('sec_bussinessblogsectionOpacity',true) ) {
		$sec_bussinessblogsectionOpacity = 'opacity:'.esc_attr(get_theme_mod('sec_bussinessblogsectionOpacity')).';';
	}
	?>	

	<section id="bussiness-news-slider" style="<?php echo esc_attr($sec_bussinessblogsectionTpadding); ?>" "<?php echo esc_attr($sec_bussinessblogsectionBpadding); ?>" "<?php echo esc_attr($sec_bussinessblogsectionLpadding); ?>" "<?php echo esc_attr($sec_bussinessblogsectionRpadding); ?>">

		<div class="container">

			<?php
			$bussiness_title = get_theme_mod('bussiness_title', 'Business');
			?> 
			<div class="row justify-content-center"> 
				<?php if($bussiness_title || $bussiness_title) { ?>
				<div class="section-title">
					
					<h2><?php echo ($bussiness_title);  ?></h2>
					
					<span class="section__border"></span>
				</div>
				<?php } ?>
			</div>
			
			<div class="owl-carousel owl-theme"> 
				<?php 
				$luzuk_bussinessblog_post_count = get_theme_mod('luzuk_bussinessblog_post_count', 12 );
				$luzuk_bussinessblog_cat_exclude = get_theme_mod('luzuk_bussinessblog_cat_exclude');
				$luzuk_bussinessblog_cat_exclude = explode(',', $luzuk_bussinessblog_cat_exclude);
				$args = array(
					'posts_per_page' => absint($luzuk_bussinessblog_post_count),
					'category__not_in' => $luzuk_bussinessblog_cat_exclude
				);
				$query = new WP_Query($args);
				if($query -> have_posts()):
					while($query -> have_posts()) : $query -> the_post();
						$lz_fitness_image = wp_get_attachment_image_src(get_post_thumbnail_id() , 'total-blog-thumb');
						?>
						<?php 
						if(has_post_thumbnail()){
							$img = esc_url($lz_fitness_image[0]);
						}
						if(empty($lz_fitness_image)){
							$img = get_template_directory_uri().'/images/nothumb-featured.png';
						}
						?>
						<div class="item">
							<div class="single-post">
								<h4>
									<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
								</h4>
								<figure class="inner-blog navy">
									<a class="postimg-link" href="<?php the_permalink(); ?>">
									<img class="blog-img" src="<?php echo $img; ?>" alt="<?php the_title(); ?>">
								</a>
									<figcaption><span><?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?></span>
										<h3><?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?></h3>
										<a href="<?php the_permalink(); ?>"></a>
									</figcaption>
								</figure>
								<div class="articles-date">
									<li><i class="fa fa-calendar"></i><?php echo get_the_date( 'M' ); ?>
									<?php echo get_the_date( 'j' ); ?>,
									<?php echo get_the_date( 'Y' ); ?>
								</li>

							</div>
							<p class="post-description">
								<?php 
								if(has_excerpt()){
									echo get_the_excerpt();
								}else{
									echo lz_fitness_excerpt( get_the_content() , 100 );
								}
								?>
							</p>

						</div>
					</div>
					<?php
				endwhile;
			endif;
			wp_reset_postdata(); 
			?>
		</div>	
	</div>
	<script>
		$(document).ready(function() {
			$('section#bussiness-news-slider .owl-carousel').owlCarousel({
				slideSpeed : 2000,
				autoplay: true,
				loop: true,               
				margin: 30,
				responsiveClass: true,
				responsive: {
					0: {
						items: 1,
						nav: true
					},
					600: {
						items:2,
						nav: true
					},
					1000: {
						items:4,
						nav: true,
						loop: false,                   
						margin: 25
					}
				}
			})
		})
	</script> 
</section>
<?php }