<?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="container">
            <?php the_title( '<h1 class="ht-main-title ">', '</h1>' ); ?> 
            <?php if( get_theme_mod('breadcrumb_button_display','show' ) == 'show') : ?>
            <div class="breadcrumbbox ">
                <div class='button'>
                  <?php luzuk_lite_the_breadcrumb(); ?> </div>
                <div class="clearfix"></div>
            </div>
            <?php endif ?>
            <div class="clearfix"></div>
    </div>
    <div class="shape shape-bottom" data-negative="true">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 100" preserveAspectRatio="none">
            <path class="shape-fill" d="M0 0L120 13.5344C240 27.3229 480 54.0104 720 54.201C960 54.0104 1200 27.3229 1320 13.5344L1440 0V122H1320C1200 122 960 122 720 122C480 122 240 122 120 122H0V0Z"></path>
        </svg>
    </div>
    <div class="clearfix"></div>
</header>

<main id="innerpage-box">
    <?php
        // width 
        $c_width = get_theme_mod('innpg_c_width', 'container');

        if ($c_width === 'container') {
            $c_alignment = 'container';
        } elseif ($c_width === 'container-fluid') {
            $c_alignment = 'container-fluid';
        } else {
            $text_alignment = 'container'; // Default to 'container' if the setting is invalid
        }
            
    ?>
    <div class="<?php echo esc_attr($c_width); ?>">
        <div class="inner_contentbox">
            <div id="blog-box" class="ht-blog-wrap innerpage-whitebox ">
                <div class="row mr-0">
              <?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/default.png';
                     ?>
                 <div class="inner-blog-post col-lg-4 col-md-6 col-sm-6 col-xs-12 ">
                    <?php 
                        $blgtxtlimit = get_theme_mod('blgtxtlimit', '110');
                    ?> 
                    <div class="inner-blogpost">
                        <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="inner-blogpost-info">
                            <?php if( get_theme_mod('postdate_button_display','show' ) == 'show') :?>
                            <div class="blog-admbx">
                                <li> <i class="fa fa-calendar"></i> <?php echo get_the_date( 'M j, Y' ); ?></li>
                                <li class="b_ath"> <i class="fa fa-comments-o" ></i> <?php echo get_the_author(); ?></li>
                            </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(),$blgtxtlimit );  
                               }
                            ?>                         
                            </div>
                        </div>                   
                        <div class="clearfix"></div>
                    </div>
                    <script type="text/javascript">
                        var title = 0;
                        jQuery(".page-template-blog-left-sidebar .inner-blogpost").each(function(){
                          if ($(this).height() > title) { title = $(this).height(); }
                        });
                        jQuery(".page-template-blog-left-sidebar .inner-blogpost").height(title);


                        // on Resize change height

                        jQuery(window).resize(function(){
                          jQuery(".page-template-blog-left-sidebar .inner-blogpost").height("");
                          var title = 0;
                          jQuery(".page-template-blog-left-sidebar .inner-blogpost").each(function(){
                            if ($(this).height() > title) { title = $(this).height(); }
                          });
                          jQuery(".page-template-blog-left-sidebar .inner-blogpost").height(title);
                        });
                    </script>
                 </div> 
                   <?php
                       endwhile;
                    endif;
                    wp_reset_postdata();
                    ?>
                    <div class="clearfix"></div>
                </div>
            </div>
            <div class="clearfix"></div>
            <div class="row mr-0">
                <div class="col-md-12">
                    <div class="pagingation">
                         <?php lzGetPagination($query);?>
                    </div>
                </div>
            </div>
          <div class="clearfix"></div>
      
      </div>
    </div>
</main>

<?php get_footer(); ?>
