<?php 
/*
Template Name: Blog Masonry
*/
get_header(); ?>
<!--==================== newses breadcrumb section ====================-->
<?php get_template_part('index','banner'); ?>
  <!--==================== main content section ====================-->
<!--==================== main content section ====================-->
<section class="ta-blog-slider-warraper">
  <div class="swiper-container featuredcat">
    <div class="swiper-wrapper">
    <?php
  $newses_slider_post_enable = get_theme_mod('newses_slider_post_enable','true');
  $slider_post_category = array();
  $slider_post_category = get_theme_mod('slider_category');
  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  
  if($newses_slider_post_enable !='true')
  {
  $args = array( 'post_type' => 'post','ignore_sticky_posts' => 1, 'category__not_in' => $slider_post_category );  
  }
  else
  {
  $arg = array( 'post_type'=>'post','ignore_sticky_posts' => 1);
  }
  $t=true;
  $loop = new WP_Query( $arg );
  if ( $loop->have_posts() ) :
    while ( $loop->have_posts() ) : $loop->the_post(); 
      global $loop;
        $newses_url = newses_get_freatured_image_url($loop->ID, 'newses-slider-full');
      ?>
      <div class="swiper-slide <?php if($t==true){echo 'active';}$t=false; ?>">
      <!-- blog -->
        <div class="mg-blog-post-3 lg back-img"  <?php if (!empty($newses_url)): ?> style="background-image: url('<?php echo esc_url($newses_url); ?>');" <?php endif; ?> >
          <div class="mg-blog-inner">
            <div class="mg-blog-category"> <?php newses_post_categories(); ?> </div>
            <span class="post-form"><i class="fa fa-camera"></i></span>
            <h4 class="title lg"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
            <?php newses_post_meta(); ?>
          </div>
          <a href="<?php the_permalink(); ?>" class="link-div"></a>
        </div>
      </div>
  <?php endwhile; endif; wp_reset_postdata(); ?>
    </div>
  </div>
</section>
<div class="clearfix"></div>
<main id="content">
  <div class="container">
    <div class="row">
      <div id="list" class="col">
        <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'post','paged'=>$paged,'posts_per_page' => '6');    
          $post_type_data = new WP_Query( $args );
            while($post_type_data->have_posts()){
            $post_type_data->the_post();
            global $more;
            $more = 0; ?>
        <!--col-md-4-->
        <div class="grid-item w-100 mb-5">
          <div class="mg-blog-post-box">
            <?php $url = newses_get_freatured_image_url($post->ID, 'full'); ?>
            <div class="mg-blog-thumb md back-img" style="background-image: url('<?php echo esc_url($url); ?>');">
              <a href="<?php the_permalink(); ?>" class="link-div"></a>
              <div class="mg-blog-category">
                <?php newses_post_categories(); ?>
              </div>
              <span class="post-form"><i class="fa fa-camera"></i></span>
            </div>
            <article class="small px-0 mt-2">
              <h4 class="title"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute( array('before' => 'Permalink to: ','after'  => '') ); ?>"> <?php the_title(); ?></a> </h4>
                  <?php newses_post_meta(); ?>
            </article>
          </div>
        </div>
        <!--/col-md-4-->
        <?php } ?>
      </div>
      <!--col-md-12-->
      <div class="col-md-12 text-center d-flex justify-content-center">
        <?php $newses_pagination = new newses_pagination();
          $newses_pagination->newses_page($paged, $post_type_data); ?>
      </div>
      <!--/col-md-12-->
    </div>  
  </div>
</main>
<?php
get_footer(); ?>