<?php
if(!th_checkbox_filter('blog','section_on_off')) :
?>
<?php if (get_theme_mod('blog_parallax','on')=='on') { ?>
<section id="latest-post" data-center="background-position: 50% 0px;" data-top-bottom="background-position: 50% -100px;" class="plrx_enable">
  <?php } else { ?>
  <section id="latest-post">
    <?php } ?>
    <div class="container">
      <div class="page-post">
        <?php if(get_theme_mod( 'blog_head_')!=''){?>
        <h2 class="main-heading wow fadeInRight" data-wow-delay="0.3s"><?php echo get_theme_mod( 'blog_head_'); ?></h2>
        <?php } else { ?>
        <h2 class="main-heading wow fadeInRight" data-wow-delay="0.3s"><?php _e('Latest Post','portfoliolite'); ?></h2>
        <?php } ?>
        <?php if(get_theme_mod( 'blog_desc_')!=''){?>
        <p class="sub-heading wow fadeInLeft" data-wow-delay="0.3s"><?php echo get_theme_mod( 'blog_desc_'); ?></p>
        <?php } else { ?>
        <p class="sub-heading wow fadeInLeft" data-wow-delay="0.3s"><?php _e('Lorem ipsum dolor sit amet, consectetuer adipiscing elit ','portfoliolite'); ?></p>
        <?php } ?>
        <div class="post-block">
          <ul class="post-grid wow fadeInLeft">
            <?php
            $loop = new WP_Query(array('posts_per_page' => get_theme_mod('slider_count',4),
            'cat' => get_theme_mod('slider_cate'),
            'order' => 'DESC',
            'meta_query' => array(array( 'key' => '_thumbnail_id')) ));
            if ($loop->have_posts()) {
            $i = 0;
            ?>
            <?php  while ($loop->have_posts()) : $loop->the_post();
            $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ),'size' );
            ?>
            <li class="post-list">
              <figure class="blog-efct ">
                <div class="image"><img src="<?php echo $thumbnail_src[0]; ?>" alt=""/>
                  <div class="icons"><a href="<?php esc_url(the_permalink()); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><i><?php _e('READ MORE','portfoliolite');?></i></a></div>
                </div>
                <figcaption>
                <a href="<?php esc_url(the_permalink()); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><h3><?php the_title(); ?></h3></a>
                <?php echo portfoliolite_get_th_custom_excerpt(); ?>
                </figcaption><a href="#"></a>
              </figure>
            </li>
            <?php endwhile; ?>
            <?php } ?>
          </ul>
        </div>
      </div>
    </div>
  </section>
  <?php endif; ?>