<?php
/**
 * Template Name: Blog with right sidebar
 *
 * @package LZ Fitness Premium
 */
get_header(); 
?>
<header class="page-main-header">
	

</header><!-- .entry-header -->
  <?php if( get_theme_mod('breadcrumb_button_display','show' ) == 'show') :
        ?>
        <div class="breadcrumbbox">
            <div class="col-md-10 col-md-offset-1">
                <div class='button'><?php lz_fitness_lite_the_breadcrumb(); ?></div>
                <!--  <?php //lz_fitness_lite_the_breadcrumb(); ?> -->
                <div class="clearfix"></div>
            </div>
            <div class="clearfix"></div>
        </div>
         <div class="clearfix"></div>

    <?php endif ?>    

<?php 
            if( get_theme_mod('innerpagesbox_toppadding',true) ) {
                $innerpagesbox_toppadding = 'padding-top:'.esc_attr(get_theme_mod('innerpagesbox_toppadding')).';';
            }
            if( get_theme_mod('innerpagesbox_bottompadding',true) ) {
                $innerpagesbox_bottompadding = 'padding-bottom:'.esc_attr(get_theme_mod('innerpagesbox_bottompadding')).';';
            }
            if( get_theme_mod('innerpagesbox_leftpadding',true) ) {
                $innerpagesbox_leftpadding = 'padding-left:'.esc_attr(get_theme_mod('innerpagesbox_leftpadding')).';';
            }
            if( get_theme_mod('innerpagesbox_rightpadding',true) ) {
                $innerpagesbox_rightpadding = 'padding-right:'.esc_attr(get_theme_mod('innerpagesbox_rightpadding')).';';
            }
    ?>

<main id="innerpage-box" style="<?php echo esc_attr($innerpagesbox_toppadding); ?>" "<?php echo esc_attr($innerpagesbox_bottompadding); ?>" "<?php echo esc_attr($innerpagesbox_leftpadding); ?>" "<?php echo esc_attr($innerpagesbox_rightpadding); ?>">
	<div class="col-md-10 col-md-offset-1">
		<div id="blogmain-box" class="col-md-9 innerpage-whitebox">
			<?php 
			$current_page = max(1, get_query_var('paged'));
			$lz_fitness_blog_post_count = get_theme_mod('lz_fitness_blog_post_count', 3 );
			$lz_fitness_blog_cat_exclude = get_theme_mod('lz_fitness_blog_categories');
			$lz_fitness_blog_cat_exclude = explode(',', $lz_fitness_blog_cat_exclude);
			$excerpt = get_theme_mod('lz_fitness_blog_categories_settings');
			$args = array(
				'paged'=> $current_page,
				'category__not_in' => $lz_fitness_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');
					$img = (has_post_thumbnail())?esc_url($lz_fitness_image[0]):get_template_directory_uri().'/images/default.png';
					?>
                   <div class="inner-blog-post">
                    <div class="row row-eq-height">
                        
                      <div class="col-md-4 ht-blog-thumbnail padding0">
                      <div class="inside-full-height"> 
                         <a href="<?php the_permalink(); ?>"><img class="inner-blog-img" src="<?php echo $img; ?>" alt="<?php the_title(); ?>"></a>
                     </div>
                    </div>
                     <div class="col-md-8 inner-blog-excerpt">
                        <div class="inside-full-height">
                         <h4><?php the_title(); ?></h4>
                         <div class="ht-blog-comment">
                            <span><b><i class="fa fa-user"></i>
                                By <?php echo get_the_author(); ?></b></span>
                         <i class="fa fa-comment" aria-hidden="true"></i>
                         <?php echo $my_var = get_comments_number(); ?> Comments
                         </div>
                         <div class="ht-blog-date"><i class="fa fa-calendar-o" aria-hidden="true"></i><?php echo get_the_date(); ?></div>
                                                    <div class="clearfix"></div>

                         <?php 
                         if($excerpt === 1 ){
                            echo get_the_content();
                        }else{
                            echo (get_the_excerpt())?get_the_excerpt():lz_fitness_excerpt( get_the_content() , 200 );
                            // echo lz_fitness_excerpt( get_the_content() , 240 );
                        } ?>
                        <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://plus.google.com/share?url=<?php the_permalink();?>" target="_parent"><i class="fa fa-google-plus" 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>
                      <div class="blog-read-more">
                         <a href="<?php the_permalink(); ?>"><?php _e('Learn More', 'total'); ?></a>
                    </div>
                    </div>
                    </div>
                   </div>
                 <div class="clearfix"></div>
             </div>
					<?php
				endwhile;
			endif;
			wp_reset_postdata();
			?>
		</div>
		<div class="col-md-3">
			<div id="secondary" class="widget-area">
				<?php dynamic_sidebar('lz-fitness-blog-sidebar'); ?>
			</div>
		</div>
		<div class="clearfix"></div>
		
		<div class="row">
			<div class="col-md-12">
				<div class="pagingation">
				    <?php lzGetPagination($query);?>
				</div>
			</div>
		</div>
	</div>
	<div class="clearfix"></div>
</main>
<?php get_footer(); ?>
