<?php 
$fortune_theme_options = fortune_theme_options();
if(!$fortune_theme_options['portfolio_home']){return;}
$portfolio_page = absint(get_theme_mod( "fortune_portfolio_page", 0 ));
$fortune_portfolio_page = get_post($portfolio_page);
if($fortune_theme_options['portfolio_home_title']!=""){?>
<div class="title-centered title-decorated">
  <h1 id="port_head"><?php echo wp_kses_post($fortune_theme_options['portfolio_home_title']);?></h1>
</div><?php
} 
?>
<!-- Project Feed -->
    <div class="project-feed row"><?php  
	if($portfolio_page):?>
    <div class="col-md-12"><?php	echo apply_filters('the_content',$fortune_portfolio_page->post_content);?> </div>
<?php	else:
     $portfolio_no        = 3;
    $portfolio_pages      = array();
    for( $i = 1; $i <= $portfolio_no; $i++ ) {
        $portfolio_pages[]    =  get_theme_mod( "fortune_portfolio_page_$i", 1 );
         
    }
    $portfolio_args  = array(
        'post_type' => 'page',
        'post__in' => array_map( 'absint', $portfolio_pages ),
        'posts_per_page' => absint($portfolio_no),
        'orderby' => 'post__in'
       
    );  
    $fortune_portfolio = new   wp_Query( $portfolio_args );
	 if($fortune_portfolio->have_posts()){
    while($fortune_portfolio->have_posts()):
      $fortune_portfolio->the_post(); ?>
      <div class="col-sm-6 col-md-4 project-item">
        <div class="project-item-inner">
          <?php if(has_post_thumbnail()){
            $port_image_id = get_post_thumbnail_id();
            $port_image = wp_get_attachment_image_src( $port_image_id, 'fortune_portfolio_thumb');
            $port_image_full = wp_get_attachment_image_src( $port_image_id, 'large');?>
          <figure class="alignnone project-img"> <img class="img-responsive" src="<?php echo esc_url_raw($port_image[0]); ?>" alt="" />
            <div class="overlay">
              <a href="<?php the_permalink();?>" class="dlink"><i class="fa fa-link"></i></a>
              <a href="<?php echo esc_url_raw($port_image_full[0]); ?>" class="popup-link zoom"><i class="fa fa-search-plus"></i></a>
            </div>
          </figure>
        <?php } ?>
          <div class="project-desc">
            <h4 class="title"><a href="<?php the_permalink();?>"><?php the_title();?></a></h4>
        </div>
      </div>
    </div>
	<?php endwhile; 
  wp_reset_postdata();
 } endif; ?>
     </div>
    <!-- Project Feed / End -->