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

	<?php 
	if( get_theme_mod('blogTpadding',true) ) {
		$blogTpadding = 'padding-top:'.esc_attr(get_theme_mod('blogTpadding')).';';
	}
	if( get_theme_mod('blogBpadding',true) ) {
		$blogBpadding = 'padding-bottom:'.esc_attr(get_theme_mod('blogBpadding')).';';
	}
	?>	
	<section id="ht-blog-box">
		<div class="lightbox" style="<?php echo esc_attr($blogTpadding); ?>" "<?php echo esc_attr($blogBpadding); ?>">
			
			<div class="container">

				<?php
				$blog_area_subtitle = get_theme_mod('blog_area_subtitle', 'HEADING HERE');
				$blog_area_title = get_theme_mod('blog_area_title', 'Latest <span>Post</span>');
				$blog_area_content = get_theme_mod('blog_area_content', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eu pharetra ex. Etiam eget diam ligula..');
				?>
				<?php if($blog_area_subtitle || $blog_area_title){ ?>
					<div class="col-md-6 col-md-offset-3 col-sm-12 section-title-subtitle">

						<div class="section-subheading text-center">
							<?php
							if(!empty($blog_area_subtitle))  { 
								echo ($blog_area_subtitle);
							} ?>										
						</div>
						<h2 class="section-heading text-center">
							<?php
							if(!empty($blog_area_title))  {
								echo ($blog_area_title);
							} ?>
						</h2>

					</div>
				<?php }?>
				<div class="col-md-6 col-md-offset-3 col-sm-12 section-text">
					<?php
					if(!empty($blog_area_content))  {
						echo ($blog_area_content);
					} ?>
				</div>

				<div class="clearfix"></div>
				<div class="owl-carousel owl-theme">
					<?php 
					$blog_post_count = get_theme_mod('blog_post_count', 18 );
					$blog_cat_exclude = get_theme_mod('blog_cat_exclude');
					$blog_cat_exclude = explode(',', $blog_cat_exclude);
					$args = array(
						'posts_per_page' => absint($blog_post_count),
						'category__not_in' => $blog_cat_exclude
					);
					$query = new WP_Query($args);
					if($query -> have_posts()):
						while($query -> have_posts()) : $query -> the_post();
							$blog_image = wp_get_attachment_image_src(get_post_thumbnail_id() , 'total-blog-thumb');
							?>
							<?php 
							if(has_post_thumbnail()){
								$img = esc_url($blog_image[0]);
							}
							if(empty($blog_image)){
								$img = get_template_directory_uri().'/images/nothumb-featured.png';
							}
							?>

							<div class="item">
								<div class="section-element section-element-blog">

									<a class="main-btn1 btn-1" href="<?php the_permalink(); ?>">
										<?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?>
									</a>

									<div class="post uk-grid-margin bg-hovered uk-width-1-3@m uk-scrollspy-inview uk-animation-slide-bottom-small" style="">
										<div class="thumb_backound pr4 pl4 uk-transition-toggle uk-light uk-flex-bottom" >
												
													
														<img class="blog-img" src="<?php echo $img; ?>" alt="<?php the_title(); ?>">																
													
													
												
											<div class="entry-hover"></div>
											<div class="uk-flex uk-flex-column">

												<div class="blog-date animation-delay-01">
													<span>
														<a href="<?php the_permalink(); ?>"> <li><i class="fa fa-user"></i> by <?php echo get_the_author(); ?></li>  
															<li>
																<i class="fa fa-calendar"></i> <?php echo get_the_date( 'j F Y' ); ?>
															</li></a></span>
														</div>

														<h3 class="animeblogtitle">
															<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
														</h3>
														<p class="animeblogtext">
															<?php 
															if(has_excerpt()){
																echo get_the_excerpt();
															}else{
																echo lz_fitness_excerpt( get_the_content() , 110 );
															}
															?>
														</p>

													</div>
												</div>
												<?php if( get_theme_mod('blog_button_display','show' ) == 'show') :
												?>	
												<a class="main-btn btn-1" href="<?php the_permalink(); ?>"><i class="fa fa-long-arrow-right"></i></a>
											<?php endif ?>
											</div> 


										</div><!-- end .section-element/blog -->
									</div>

									<?php
								endwhile;
							endif;
							wp_reset_postdata();
							?>
						</div>	
					</div>
				</div>
			</section>
			<script>
				$(document).ready(function() {
					$('section#ht-blog-box .owl-carousel').owlCarousel({
						slideSpeed : 500,
						autoplay: true,
						loop: true,               
						margin: 40,
						responsiveClass: true,
						responsive: {
							0: {
								items: 1,
								dots: false,
								nav: false
							},
							600: {
								items:2,
								dots: false,
								nav: false
							},
							1000: {
								items:3,
								nav: false,
								dots: false,
								loop: false,                   
								margin: 40
							}
						}
					})
				})
			</script> 
			
		<?php }