<?php 
/**
 *
 * @package Luzuk 
 */

if(get_theme_mod('luzuk_them_blog_section_disable') != 'on' ){ ?>
	<section id="ht-blog-box">
		<?php 
		if( get_theme_mod('sec_blogsectionTpadding',true) ) {
			$sec_blogsectionTpadding = 'padding-top:'.esc_attr(get_theme_mod('sec_blogsectionTpadding')).';';
		}
		if( get_theme_mod('sec_blogsectionBpadding',true) ) {
			$sec_blogsectionBpadding = 'padding-bottom:'.esc_attr(get_theme_mod('sec_blogsectionBpadding')).';';
		}
		if( get_theme_mod('sec_blogsectionLpadding',true) ) {
			$sec_blogsectionLpadding = 'padding-left:'.esc_attr(get_theme_mod('sec_blogsectionLpadding')).';';
		}
		if( get_theme_mod('sec_blogsectionRpadding',true) ) {
			$sec_blogsectionRpadding = 'padding-right:'.esc_attr(get_theme_mod('sec_blogsectionRpadding')).';';
		}
		?>	
		<div class="lightbox wow fadeInDown" data-wow-duration="1s" style="<?php echo esc_attr($sec_blogsectionTpadding); ?>" "<?php echo esc_attr($sec_blogsectionBpadding); ?>" "<?php echo esc_attr($sec_blogsectionLpadding); ?>" "<?php echo esc_attr($sec_blogsectionRpadding); ?>">
			<div class="container">
				
				<?php
				$luzuk_them_blog_title = get_theme_mod('luzuk_them_blog_title', 'Our Blog');
				
				?>


				<div class="ht-section-title-tagline">
					
											
					<?php if($luzuk_them_blog_title){ ?>						
					
						<h2 class="ht-section-title lz-blog-heading">
							<?php
							if(!empty($luzuk_them_blog_title))	{
								echo ($luzuk_them_blog_title);
							} ?>
						</h2>
						<div class="clearfix"></div> 
						<div class="titlebor"></div>
					<?php }?>
					<div class="clearfix"></div> 
					
				</div>
				<div class="clearfix"></div>


				<div class="ut-blog-post"> 
					

					<?php 
					$luzuk_them_blog_post_count = get_theme_mod('luzuk_them_blog_post_count', 5 );
					$luzuk_them_blog_cat_exclude = get_theme_mod('luzuk_them_blog_cat_exclude');
					$luzuk_them_blog_cat_exclude = explode(',', $luzuk_them_blog_cat_exclude);
					$args = array(
						'posts_per_page' => absint($luzuk_them_blog_post_count),
						'category__not_in' => $luzuk_them_blog_cat_exclude
					);
					$query = new WP_Query($args);
					if($query -> have_posts()):
						while($query -> have_posts()) : $query -> the_post();
							$luzuk_them_image = wp_get_attachment_image_src(get_post_thumbnail_id() , 'total-blog-thumb');
							?>
							<?php 
							if(has_post_thumbnail()){
								$img = esc_url($luzuk_them_image[0]);
							}
							if(empty($luzuk_them_image)){
								$img = get_template_directory_uri().'/images/nothumb-featured.png';
							}
							?>
							<div class="col-md-4 col-sm-6">
								<div class="our-homepage-blog">
									
										<div class="pc_blog_img">
											<a href="<?php the_permalink(); ?>">
											
											<img class="blog-img" src="<?php echo $img; ?>" alt="<?php the_title(); ?>">											
											</a>

											<ul class="social text-center">
												<li><?php echo get_the_date( 'j' ); ?>
													<span><?php echo get_the_date( 'M' ); ?></span>
												</li>

											</ul>
										</div>
									
									<div class="pc_blog_content pc-blog-content">
										<!-- <ul>
											<li><?php //echo get_the_author(); ?></li>
											<li><?php //echo $my_var = get_comments_number(); ?> Comments</li>
										</ul> -->
										<h3 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
										<p class="post"><?php 
										if(has_excerpt()){
											echo get_the_excerpt();
										}else{
											echo luzuk_them_excerpt( get_the_content() , 85 );
										}
										?></p>
										<?php
										$homepageblogbtnsectionbutton = get_theme_mod('luzuk_them_homepageblogpostbtnsection_txt', 'READ MORE'); 
										?>
										<?php if( get_theme_mod('homepageblogpostbtnection_button_display','show' ) == 'show') :
											?>	
											<a href="<?php the_permalink(); ?>" class="site-button"><?php echo ($homepageblogbtnsectionbutton );  ?> <i class="fa fa-caret-right" aria-hidden="true"></i></a>
										<?php endif ?>
									</div>
								</div>
							</div>
							<?php
						endwhile;
					endif;
					wp_reset_postdata(); 
					?>

					
					<div class="clearfix"></div>
				</div>	

			</div>
		</div>

	</section>
	<script>
		jQuery.noConflict();
		$(function(){
			function pcblogcontentHeight(){
				var ht = 0;
				$('section#ht-blog-box .pc_blog_content').each(function(i){
					var tHt = $(this).height();
					if(ht<tHt){
						ht=tHt;
					}
				});
				$('section#ht-blog-box .pc_blog_content').height(ht+'px');
			}
			pcblogcontentHeight();
		});
		$( window ).resize(function(){
			pcblogcontentHeight();
		});
	</script>

<?php }