<?php

namespace PowerElements;
use PowerElements\Helpers\Partials as Partials;
use PowerElements\Helpers\Utils as Utils;
	/**
	 * Created by PhpStorm.
	 * User: j3sha
	 * Date: 6/23/2019
	 * Time: 3:46 PM
	 */
	
	$getCats = get_the_terms(get_the_ID(), 'peeao_portfolio_cat'); 

	if (is_array($getCats)) {
		$html ='<p class="power_portfolio_filter_item_tag">';
		$attr ='';
		foreach ($getCats as $key => $cat) {
			if (count($getCats)==1 || $key==count($getCats)-1){
				$coma ='';
			}else{
				$coma =', ';
			}
			$html .=$cat->name.$coma;
			$attr .=' '.$cat->slug.' ';
		}
		$html .='</p>';
	}else{
		$html ='';
		$attr ='';
	}
	$port_icon = $post_args['peeao_portfolio_filter_style'] == 'portfolio_hover' ?
	'<i class="'.esc_attr($post_args['peeao_portfolio_filter_icon']).'"></i>' : '';

?>
<div class="power_portfolio_filter_item <?php echo esc_attr($attr);?>">
	<div class="power_portfolio_thumb">
		<?php if($post_args['peeao_portfolio_filter_style'] == 'portfolio_left_right' ){ ?> 
			<div class="grid-2">
				<div class="grid-sizer <?php echo $arr[0];?>">
					<h4 class="power_portfolio_filter_item_title"><a
						href="<?php echo esc_url( get_the_permalink( get_the_ID() ) ) ?>"><?php echo the_title(); ?></a></h4>
					<div class="port-excerpt"><?php the_excerpt();?></div>
					<a href="<?php echo esc_url( get_the_permalink( get_the_ID() ) ) ?>" class="btn btn-portfolio"><?php echo $post_args['peeao_portfolio_filter_button_label']; ?></a>
				</div>
				<div class="grid-sizer  <?php echo $arr[1];?>">
					<img class="power_portfolio_filter_item_image" src="<?php echo esc_url(wp_get_attachment_image_url( get_post_thumbnail_id(), 'full' ))?>" alt="<?php echo get_the_title(); ?>"/>
				</div>
			</div>
		<?php }else{ ?>
			<img class="power_portfolio_filter_item_image" src="<?php echo esc_url(wp_get_attachment_image_url( get_post_thumbnail_id(), 'full' ))?>" alt="<?php echo get_the_title(); ?>"/>
			<div class="power_portfolio_info">
				<?php if($post_args['peeao_portfolio_filter_show_popup']=='yes'){?>
					<?php if($post_args['peeao_portfolio_filter_icon'] != ''){?>
						<a class="power_portfolio_popup" href="<?php echo esc_url(wp_get_attachment_image_url( get_post_thumbnail_id(), 'full' ))?>" data-fancybox="images"><?php echo Utils::kses($port_icon); ?></a>
					<?php }else{ ?> 
						<a class="power_portfolio_popup" href="<?php echo esc_url(wp_get_attachment_image_url( get_post_thumbnail_id(), 'full' ))?>" data-fancybox="images"></a>	
					<?php } ?>
				<?php } ?>
				<div class="power_portfolio_label_text">
					<h4 class="power_portfolio_filter_item_title"><a
							href="<?php echo esc_url( get_the_permalink( get_the_ID() ) ) ?>"><?php echo the_title(); ?></a></h4>
					
					<?php if($post_args['peeao_portfolio_filter_style'] == 'portfolio_hover_2'){ ?>
						<p class="port-excerpt"><?php echo wp_trim_words( get_the_excerpt(), 10 ); ?></p>
					<?php } else{ 
						echo Utils::kses($html); 
					} ?>
					<a href="<?php echo esc_url( get_the_permalink( get_the_ID() ) ) ?>" class="btn btn-portfolio"><?php echo $post_args['peeao_portfolio_filter_button_label']; ?></a>
				</div>
			</div>
		<?php } ?>
	</div>
</div>