<?php 
/**
 * The main template file.
 *
 * Used to display the homepage when home.php doesn't exist.
 */
?>
<?php get_header(); ?>
<header class="page-main-header innerblogstatpage">
	
</header>

<main id="innerpage-box">
	<div class="container">
		<div class="inner_contentbox">
		<div id="blog-box" class="col-md-9 innerpage-whitebox">
			<div class="innerblogpost">
			<?php 
			$current_page = max(1, get_query_var('paged'));
			$luzuk_blog_post_count = get_theme_mod('luzuk_blog_post_count', 3 );
			$luzuk_blog_cat_exclude = get_theme_mod('luzuk_blog_categories');
			$luzuk_blog_cat_exclude = explode(',', $luzuk_blog_cat_exclude);
			$excerpt = get_theme_mod('luzuk_blog_categories_settings');
			$args = array(
				'paged'=> $current_page,
				'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');
					$img = (has_post_thumbnail())?esc_url($luzuk_image[0]):get_template_directory_uri().'/images/default.png';
					?>
					<div class="post excerpt">
					<div class="inner-catblogpost wow zoomIn">
	                    <div class="ht-catblog-thumbnail">

	                            <a href="<?php the_permalink(); ?>">
									<div class="featured-thumbnail">
										<img class="inner-blog-img" src="<?php echo $img; ?>" alt="<?php the_title(); ?>">
									</div>
								</a>
	                             
	               		</div>

                     <div class="inner-catblogpost-info">
                        <div class="inner-blog-excerpt">
                        	 <h2><?php the_title(); ?></h2>
                            <?php if( get_theme_mod('postdate_button_display','show' ) == 'show') :
                               ?>
                          		<div class="ht-blog-date"><i class="fa fa-calendar-o" aria-hidden="true"></i><?php echo get_the_date(); ?></div>
                            <?php endif ?> 
                           
	                          <?php 
	                         if (has_excerpt()) {
	                                    echo get_the_excerpt();
	                                } else {
	                                    echo luzuk_excerpt(get_the_content(),300);
	                                
	                             }
                             ?>
                        </div>
                         <?php if( get_theme_mod('postsocialsshare_button_display','show' ) == 'show') :
								?>
								<div class="socialMedia">
									
									<a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink();?>" target="_parent"><i class="fa fa-facebook" aria-hidden="true"></i></a>
									<a href="https://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink();?>&title=<?php the_title();?>&source=<?php the_title();?>" target="_parent"><i class="fa fa-linkedin" aria-hidden="true"></i></a>
									
									<a href="https://twitter.com/share?url=<?php the_permalink();?>&amp;text=<?php the_title();?>" target="_blank"><i class="fa fa-twitter" aria-hidden="true"></i></a>
									<a href="http://www.digg.com/submit?url=<?php the_permalink();?>" target="_blank"><i class="fa fa-digg" aria-hidden="true"></i></a>
									<div class="clearfix"></div>
								</div>
							<?php endif ?> 
                         <?php if( get_theme_mod('blogpage_button_display','show' ) == 'show') :
		                   	?>
		                      <?php
		                        $bloginner_page_id = get_theme_mod('bloginner_page'); 
		                        $bloginnerbutn_text = get_theme_mod('blogbutninner_text', 'Continue Reading');
		                       ?>

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

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

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

                <div class="clearfix"></div>
            </div>
					<?php
				endwhile;
			endif;
			wp_reset_postdata();
			?>
			</div>
		</div> 
		<div class="col-md-3">
			<div id="secondary" class="widget-area">
				<?php dynamic_sidebar('luzuk-blog-sidebar'); ?>
			</div>
		</div>
		<div class="clearfix"></div>
		
		<div class="row">
			<div class="col-md-12">
				<div class="pagingation">
					<?php lzGetPagination($query);?>
					<div class="clearfix"></div>
				</div>
			</div>
		</div>
		<div class="clearfix"></div>
	</div>
	</div>
</main>
<?php get_footer(); ?>
