<?php
/** 
 *
 * @package Luzuk 
 */
if(get_theme_mod('luzuk_blog_section_disable') != 'on' ){ ?>
	<section id="ht-blog-box" class="wow slideInUp">
		<?php 
		if( get_theme_mod('sec_blogTpadding',true) ) {
			$sec_blogTpadding = 'padding-top:'.esc_attr(get_theme_mod('sec_blogTpadding')).';';
		}
		if( get_theme_mod('sec_blogBpadding',true) ) {
			$sec_blogBpadding = 'padding-bottom:'.esc_attr(get_theme_mod('sec_blogBpadding')).';';
		}
		?>	
		<div class="lightbox" style="<?php echo esc_attr($sec_blogTpadding); ?>" "<?php echo esc_attr($sec_blogBpadding); ?>">
			<div class="container">
				<?php
				$luzuk_blog_title = get_theme_mod('luzuk_blog_title', 'Latest News');
				$luzuk_blog_sub_title = get_theme_mod('luzuk_blog_sub_title', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus eu pharetra ex. Etiam eget diam ligula. Sed at blandit ante.');
				?>
				<div class="col-md-6 col-md-offset-3">
				<div class="ht-section-title-tagline">
					<?php if($luzuk_blog_title || $luzuk_blog_sub_title){ ?>
						<h2 class="ht-section-title lz-blog-heading">
							<?php
							if(!empty($luzuk_blog_title))	{
								echo ($luzuk_blog_title);
							} ?>
						</h2>
						<p><?php echo ($luzuk_blog_sub_title); ?></p>
					<?php }?>
					<div class="clearfix"></div> 	
					
				</div>
			</div>
				<div class="clearfix"></div>
				<div class="ut-blog-post">
					<div class="ut-blog-posts-box">
						<div class="bloghomebox">
							<?php 
							$luzuk_blog_post_count = get_theme_mod('luzuk_blog_post_count', 3 );
							$luzuk_blog_cat_exclude = get_theme_mod('luzuk_blog_cat_exclude');
							$luzuk_blog_cat_exclude = explode(',', $luzuk_blog_cat_exclude);
							$args = array(
								'posts_per_page' => absint($luzuk_blog_post_count),
								'category__not_in' => $luzuk_blog_cat_exclude
							);
							$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');
									?>
									<?php 
									if(has_post_thumbnail()){
										$img = esc_url($luzuk_image[0]);
									}
									if(empty($luzuk_image)){
										$img = get_template_directory_uri().'/images/blog.jpg';
									}
									?>
									<div class="col-md-4 col-sm-6 padding18">
										<div class="mainbloghpage">
											<figure class="homepage-blog-img blue">
												<div class="imghov">
													<img class="blog-img" src="<?php echo $img; ?>" alt="<?php the_title(); ?>">
													<a href="<?php the_permalink(); ?>"><i class="fa fa-plus" aria-hidden="true"></i>
												</a>
												</div>
												<div class="detailblogbox">	
													<h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>	
													<ul>
														<li><span class="fa fa-calendar" aria-hidden="true"></span> <?php echo get_the_date( 'j F Y' ); ?>
													     </li> 	/
														<li class="cattext">
														     By : <span><?php echo get_the_author(); ?></span>
								                         </li> 
																				
													</ul>
													<div class="ht-blog-excerpt">
												<?php 
												if(has_excerpt()){
													echo get_the_excerpt();
												}else{
													echo luzuk_excerpt( get_the_content() , 100 );
												}
												?>
												
											</div>

													<?php if( get_theme_mod('blog_button_display','show' ) == 'show') :
													?>
													<?php
														$blog_page_id = get_theme_mod('blog_page'); 
														$blogbutn_text = get_theme_mod('blogbutn_text', 'Read More');
														?>

													<div class="blog-read-more">
														<a href="<?php the_permalink(); ?>"><?php echo $blogbutn_text; ?></a>
													</div>
													<?php endif ?>

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

								<?php
							endwhile;
						endif;
						wp_reset_postdata();
						?>
					</div>
				</div>
				<div class="clearfix"></div>
			</div>	
			</div>
		</div>
		<svg class="blog-topcircle" version="1.1" height="150px" width="140px" xmlns="https://www.w3.org/2000/svg">
			<circle cx="70px" cy="70px" r="70px"></circle>
		</svg>
	</section>
	<script>
		jQuery.noConflict();
		$(function(){
			function detailblogboxHeight(){
				var ht = 0;
				$('#ht-blog-box .detailblogbox').each(function(i){
					var tHt = $(this).height();
					if(ht<tHt){
						ht=tHt;
					}
				});
				$('#ht-blog-box .detailblogbox').height(ht+'px');
			}
			detailblogboxHeight();
		});
		$( window ).resize(function(){
			detailblogboxHeight();
		});
	</script>
<?php }