<?php
if(!th_checkbox_filter('portfolio','section_on_off')) :
$heading = get_theme_mod('our_port_heading','');
$subheading = get_theme_mod('our_port_subheading','');
$perpage_post = get_theme_mod('our_port_default_images',9);
$wdth = get_theme_mod('dynamic_wdth','');
$layout = get_theme_mod('dynamic_grid','');
global $grid_layout;
if (get_theme_mod('portfo_parallax','on')=='on') { ?>
<div id="portfolio-mywork-section" data-center="background-position: 50% 0px;" data-top-bottom="background-position: 50% -100px;" class="portfolio-mywork-section plrx_enable">
  <?php } else {?>
  <div id="portfolio-mywork-section" class="portfolio-mywork-section ">
    <?php } ?>
    <div class="profolio-page <?php echo $wdth;?>">
      <div class="container">
        <div class="portfolio-heading">
          <?php if($heading !=''){?>
          <h2 class="main-heading wow fadeInLeft" data-wow-delay="0.3s"><?php echo $heading ;?></h2>
          <?php } else { ?>
          <h2 class="main-heading wow fadeInLeft" data-wow-delay="0.3s"><?php _e('Our Portfolio','portfoliolite'); ?></h2>
          <?php } ?>
          <?php if($subheading !=''){?>
          <p class="sub-heading wow fadeInRight" data-wow-delay="0.3s"><?php echo $subheading ;?></p>
          <?php } else { ?>
          <p class="sub-heading wow fadeInRight" data-wow-delay="0.3s"><?php _e('Lorem ipsum dolor sit amet, consectetuer adipiscing elit ','portfoliolite'); ?></p>
          <?php } ?>
        </div>
        <?php echo portfoliolite_get_category_list($perpage_post); ?>
        <div class="portfolio-block  <?php echo $layout;?>">
          <ul class="portfolio-grid grid ">
            <?php
            $loop = new WP_Query( array(
            'post_type' => 'portfolio',
            'cat' =>get_theme_mod('our_port_category',0),
            'posts_per_page' => $perpage_post,
            'paged'         =>0,
            'meta_query' => array(array( 'key' => '_thumbnail_id')),
            ));
            if ($loop->have_posts()) {
            $i = 0;
            while ($loop->have_posts()) : $loop->the_post();
            $postCats = get_the_category();
            $liscats = '';
            foreach ($postCats as $cats){
            $liscats .= $cats->slug .' ';
            }
            echo '<li class="element-item post '.$liscats.'" data-category="transition">'?>
              <div class="portfolio-image">
                <figure class="protfolio-img-efc">
                  <?php if ( $layout =='four-Masnory' || $layout =='three-Masnory' ){ ?>
                  <?php if ( has_post_thumbnail() ) : ?>
                  <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                    <?php the_post_thumbnail(); ?>
                  </a>
                  <?php endif; ?>
                  <?php }else{?>
                  <?php if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) { ?>
                  <a href="<?php the_permalink(); ?>">
                    <?php portfoliolite_grid_thumb($grid_layout,true); ?>
                  </a>
                  <?php } }?>
                  <figcaption>
                  <a href="<?php the_permalink(); ?>"><h3><?php the_title(); ?></h3></a>
                  <p><?php the_category(', '); ?></p>
                  </figcaption>
                </figure>
              </div>
            </li>
            <?php endwhile; }
            wp_reset_postdata();
            ?>
          </ul>
        </div>
        <button class ="load-more lfb-load-more" lfb-page = "2"><?php _e('Load More','portfoliolite'); ?></button>
      </div>
    </div>
  </div>
  <?php endif; ?>