<?php
/**
 * Template Name: Blog full width
 *
 * @package Luzuk Premium
 */
get_header(); 
?>
 <?php $image = wp_get_attachment_url( get_post_thumbnail_id($post->ID));?>
<header class="page-main-header"  <?php  if (!empty($image)) : ?> style="background: url('<?php echo esc_url($image); ?>'); background-repeat: no-repeat; background-size:cover; position: relative;" <?php endif ?> >
    <div class="overlay1"></div>
    <div class="headpginn">
        <div class="pginn1">
        <?php 
            $pginn1_image5 = get_theme_mod('pginn1_image5');
            if(!empty($pginn1_image5)){
                echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($pginn1_image5).'" class="img-responsive" />';
            }else{
                echo '<img alt="Abouimg" src="'.get_template_directory_uri().'/images/hdinnerpb.png" class="img-responsive" />';
            }
        ?>
        </div>
        <?php if( get_theme_mod('breadcrumb_button_display','show' ) == 'show') : ?>
            <div class="breadcrumbbox wow zoomIn">
                <div class="container">
                    <div class='button'><?php luzuk_lite_the_breadcrumb(); ?></div>
                    <!--  <?php //luzuk_lite_the_breadcrumb(); ?> -->
                </div>
            </div>
        <?php endif ?>   
        <div class="container">
            <?php the_title( '<h1 class="ht-main-title wow zoomIn">', '</h1>' ); ?>
            <div class="clearfix"></div>
        </div>  
        <div class="pginn2">
        <?php 
            $pginn2_image5 = get_theme_mod('pginn2_image5');
            if(!empty($pginn2_image5)){
                echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($pginn2_image5).'" class="img-responsive" />';
            }else{
                echo '<img alt="Abouimg" src="'.get_template_directory_uri().'/images/hdinnerpb2.png" class="img-responsive" />';
            }
        ?>
        </div> 
    </div>
</header><!-- .entry-header -->
<main id="innerpage-box">
	<div class="container">
        <div class="inner_contentbox">
    		<div id="blog-box" class="ht-blog-wrap innerpage-whitebox">
    			<?php
                $current_page = max(1, get_query_var('paged'));
                $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(
                    'category__not_in' => $luzuk_blog_cat_exclude,
                    // 'page'=,
                    'paged'=> $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/blog.jpg';
                     ?>
                <div class="inner-blog-post col-md-4 col-sm-6 col-xs-12 wow zoomIn">
                    <div class="inner-blogpost innerblogpost">
                        <div class="ht-blog-thumbnail">
                            <a href="<?php the_permalink(); ?>">
                              <img class="inner-blog-img" src="<?php echo $img; ?>" alt="<?php the_title(); ?>">
                            </a>
                        </div>
                        <div class="innblog-catg">
                            <?php 
                                $categories = get_the_category();
                                if ( ! empty( $categories ) ) {
                                    echo '<a href="'. esc_url( get_category_link( $categories[0]->term_id ) ) . '">' . esc_html( $categories[0]->name ) . '</a>';
                                }
                            ?>
                        </div>
                        <div class="inner-blogpost-info">
                            
                           <?php if( get_theme_mod('postdate_button_display','show' ) == 'show') :
                                   ?>
                            <div class="blog-date">
                                <span> <?php echo get_the_date( 'F j, Y' ); ?></span> / By <?php echo get_the_author(); ?> 
                            </div>
                          <?php endif ?> 

                            <a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a>
                            <div class="inner-blog-excerpt">
                                <?php 
                                    if (has_excerpt()) {
                                          echo get_the_excerpt();
                                      } else {
                                          echo luzuk_excerpt(get_the_content(),150);
                                      
                                   }
                                ?>
                            </div>
                            <?php
                                $innblogbtn_text = get_theme_mod('innblogbtn_text', 'Read More');
                            ?>

                            <?php if($innblogbtn_text){ ?>
                            <div class="innblogbtn">
                                <a href="<?php the_permalink(); ?>"><?php echo $innblogbtn_text; ?></a>
                            </div>
                            <?php }?>                  

                            <div class="clearfix"></div>
                        </div>
                        <div class="clearfix"></div>   
                    </div>
                    <script>
                        jQuery.noConflict();
                        $(function(){
                          function innerblogpostHeight(){
                            var ht = 0;
                            $('#innerpage-box .innerblogpost').each(function(i){
                              var tHt = $(this).height();
                              if(ht<tHt){
                                ht=tHt;
                              }
                            });
                            $('#innerpage-box .innerblogpost').height(ht+'px');
                          }
                          innerblogpostHeight();
                        });
                        $( window ).resize(function(){
                          innerblogpostHeight();
                        });
                    </script>

                </div> 

            <?php
                endwhile;
                endif;
                wp_reset_postdata();
            ?>
            <div class="clearfix"></div>
            </div>
            <div class="pagingation">
                <?php lzGetPagination($query);?>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</main>
<?php get_footer(); ?>