<?php
/**
 *
 * @package luzuk Premium
 */
if(get_theme_mod('blog_section_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="container">
			<div class="blog-area-wrap">
				<div class="blog-posts">
					<div class="row">
						<div class="offset-xl-1 col-xl-10">
								<?php 
									$blog_cat_exclude = get_theme_mod('blog_cat_exclude');
									$blog_cat_exclude = explode(',', $blog_cat_exclude);
									$blog_current_page = max(1, get_query_var('paged', 1));
									$args = array(
										'category__not_in' => $blog_cat_exclude,
										'paged'=> $blog_current_page,
									);
									$query = new WP_Query($args);

									if($query -> have_posts()):
										while($query -> have_posts()) : $query -> the_post();
										$luzuk_image = wp_get_attachment_image_src(get_post_thumbnail_id() , 'total-blog-thumb');
                    $img = (has_post_thumbnail())?esc_url($luzuk_image[0]):get_template_directory_uri().'/images/default.png';
								?>
								<div class="blog-post">
									<div class="box-area-S wow zoomIn">
										<div class="blog-thumbnail">
											<div class="blog-imgarea">
													<div class="blog-image">
														<a href="<?php the_permalink(); ?>">
															<img class="blog-img" src="<?php echo $img; ?>" alt="<?php the_title(); ?>">
															<div class="blog-ovly"></div>
														</a>
													</div>
													<div class="blog-admin">
														<?php echo get_avatar(get_the_author_meta('ID')); ?>
															<?php echo get_the_author(); ?>
													</div>
											</div>
										</div>		
										<div class="blog-single">
												<a href="<?php the_permalink(); ?>">
													<h4 class="inner-area-title"><?php the_title(); ?></h4>
												</a>
												<p>
													<?php 
															if(has_excerpt()){
																echo get_the_excerpt();
															}else{
																echo luzuk_excerpt( get_the_content() , 600 );
															}
													?>
												</p>
												<div class="blog-bottom-area">
														<?php
							                  $blog_button1 = get_theme_mod('blog_button1', 'Continue Reading');
							             	?>
										        <?php if($blog_button1) { ?>
															<div class="blogbtn"> 
				                        <a href="<?php echo esc_url(get_permalink()); ?>">
				                        	<?php echo $blog_button1 ?>
				                        </a>
				                    	</div> 
					                 <?php }?>
					                 <div class="social-media">
							                 <?php if( get_theme_mod('socialicon_button_display','show' ) == 'show') :
					                        ?>
					                        <button type="button" class="btn share-icn"><i class="fa fa-share-alt" aria-hidden="true"></i> </button> 
					                        <div class="share-btn">
					                            <li><a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink();?>" target="_blank" class="site-button sharp"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
					                            <li><a href="https://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink();?>&title=<?php the_title();?>&source=<?php the_title();?>" target="_blank" class="site-button sharp"><i class="fa fa-linkedin" aria-hidden="true"></i></a></li>
					                            <li><a href="https://twitter.com/share?url=<?php the_permalink();?>&amp;text=<?php the_title();?>" class="site-button sharp" target="_blank"><i class="fa-brands fa-x-twitter"></i></a></li>
					                            <li><a href="https://www.instagram.com/?url=<?php the_permalink();?>" target="_blank" class="site-button sharp"><i class="fa fa-instagram" aria-hidden="true"></i></a></li>
					                            <div class="clearfix"></div>
					                        </div>
					                    <?php endif ?> 
					                </div>
												</div>
											<div class="clearfix"></div>
										</div>
										<div class="blog-page-palette">
												<div class="blog-splash"></div>
										</div>
										<div class="clearfix"></div>
									</div>
								</div>
							<?php
								endwhile;
								endif;
								wp_reset_postdata();
							?>
						</div>
				</div>
				<div class="pagingation">
					 <?php lzGetPagination($query); ?>
				</div>
			</div>
			<div class="clearfix"></div>
		</div>	
	</div>
	<div class="clearfix"></div>
</div>
<script type="text/javascript">
	var title = 0;
jQuery(".blog-area .blog-post").each(function(){
  if ($(this).height() > title) { title = $(this).height(); }
});
jQuery(".blog-area .blog-post").height(title);


// on Resize change height

jQuery(window).resize(function(){
  jQuery(".blog-area .blog-post").height("");
  var title = 0;
  jQuery(".blog-area .blog-post").each(function(){
    if ($(this).height() > title) { title = $(this).height(); }
  });
  jQuery(".blog-area .blog-post").height(title);
});
</script>
<?php }