<?php
/**
 *
 * @package Luzuk Premium
 */
if(get_theme_mod('blog_area_disable') != 'on' ){ ?>
	<?php 
 	if( get_theme_mod('blog_areaTpadding',true) ) {
 		$blog_areaTpadding = 'padding-top:'.esc_attr(get_theme_mod('blog_areaTpadding')).';';
 	}
 	if( get_theme_mod('blog_areaBpadding',true) ) {
 		$blog_areaBpadding = 'padding-bottom:'.esc_attr(get_theme_mod('blog_areaBpadding')).';';
 	}
 	?>
<div  class="blog-area" id="blog" style= "<?php echo esc_attr($blog_areaTpadding); ?>" "<?php echo esc_attr($blog_areaBpadding); ?>" >
	<!-- <div class="border-blog" style=></div> -->
		<?php			
 			$blog_title = get_theme_mod('blog_title_title', 'NEWS & BLOG');
 			$blog_subtitle = get_theme_mod('blog_title_subtitle', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Quis ipsum suspendisse ultrices gravida. Risus commodo viverra maecenas accumsan lacus vel facilisis.');
 		?>
		<div class="container">
				<div class="row justify-content-center">
				<?php if($blog_title || $blog_subtitle){ ?>
						<div class="col-md-10 col-md-offset2">
					      <div class="section-heading">
					          <h2><?php echo ($blog_title);  ?></h2>
					          <p><?php echo ($blog_subtitle);  ?></p>
					      </div>
						</div>
				<?php }?>
				</div>
				

 				<?php if( get_theme_mod('blani_img_display','show' ) == 'show') :
            ?> 
				<div class="bltop"><i class="fa fa-plus" ></i></div>
				<div class="bltoprhs">
					<?php 
						$blgdot_image = get_theme_mod('blgdot_image');
						if(!empty($blgdot_image)){
							echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($blgdot_image).'" class="img-responsive" />';
						}else{
							echo '<img alt="blgplse" src="'.get_template_directory_uri().'/images/Dotted-S2.png" class="img-responsive" />';
						}
					?>
				</div>
				<?php endif ?>
		</div>

		<div class="container">	
				<div class="blog-area-wrap">
						<div class="blog-posts">
								<?php 
									$blog_post_count = get_theme_mod('blog_post_count', 3 );
									$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();
											$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/blog2.jpg';
									}
								?>
								<div class="blog-post col-md-4 col-sm-6 col-xs-12 ">
										<div class="box-area-S">
												<div class="box-bxinn">
												<div class="blog-thumbnail">
													<a href="<?php the_permalink(); ?>">
														<img class="blog-img" src="<?php echo $img; ?>" alt="<?php the_title(); ?>">
														<div class="ovrly"></div>
														<i class="fa fa-plus" aria-hidden="true"></i>
														<div class="mdate"><span class="fa fa-calendar-check-o" aria-hidden="true"></span> <?php echo get_the_date( 'j M Y' ); ?>
														<div class="clearfix"></div> 
													</div>
													</a>
												</div>
												
												<div class="blog-single">
													<?php 
														$blog_page_id = get_theme_mod('blog_page');	
														$blog_inn_image = get_theme_mod('blog_inn_image');
													?>
														<div class="blog-single-img">
																<a href="<?php the_permalink(); ?>">
																		<h4 class="inner-area-title"><?php the_title(); ?></h4>
																</a>
																<div class="b-ather ">
																	<div class="col-md-6 col-sm-6 col-xs-6 at1"><i class="fa fa-user" ></i>	<?php echo get_the_author(); ?></div>
																	<div class="col-md-6 col-sm-6 col-xs-6 com1"><i class="fa fa-comments-o" aria-hidden="true"></i><?php echo $my_var = get_comments_number(); ?> Comments</div>
										            </div>
																<div class="section-area-text">
																		<?php 
																			if(has_excerpt()){
																				echo get_the_excerpt();
																			}else{
																				echo luzuk_excerpt( get_the_content() , 130 );
																			}
																		?>
																</div>
														</div>
														<div class="clearfix"></div>
												</div>
												<div class="clearfix"></div>
										</div>
									</div>
								</div>
								<?php
							endwhile;
							endif;
							wp_reset_postdata();
							?>
					</div>
					<div class="clearfix"></div>
				</div>	
		</div>
		<div class="clearfix"></div>
</div>
<script type="text/javascript">
$(document).ready(function(){
    var highestBox = 0;
        $('.blog-area .box-area-S').each(function(){  
                if($(this).height() > highestBox){  
                highestBox = $(this).height();  
        }
    });    
    $('.blog-area .box-area-S').height(highestBox);
});
</script>

<?php }