have_posts() ){
while ( $query->have_posts() ){
$query->the_post();
$item_class = array();
$categories = '';
$terms = get_the_terms( get_the_ID(), 'portfolio-types' );
if( is_array( $terms ) ){
foreach( $terms as $term ){
$item_class[] = 'category-'. $term->slug;
$categories .= ''. $term->name .', ';
}
$categories = substr( $categories , 0, -2 );
}
$item_class[] = get_post_meta( get_the_ID(), 'mfn-post-size', true );
$item_class[] = has_post_thumbnail() ? 'has-thumbnail' : 'no-thumbnail';
$item_class = implode(' ', $item_class);
$ext_link = get_post_meta( get_the_ID(), 'mfn-post-link', true );
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'large' );
// item backgrounds
// style: list
if( $item_bg_image = get_post_meta( get_the_ID(), 'mfn-post-bg', true ) ){
$item_bg_image = 'background-image:url('. esc_url($item_bg_image) .');';
}
// style: masonry hover
$item_bg_class = 'bg-'. mfn_brightness( mfn_opts_get( 'background-imageframe-link', '#fff', [ 'key' => 'normal' ] ), 169 );
if( $item_bg_color = get_post_meta( get_the_ID(), 'mfn-post-bg-hover', true ) ){
$item_bg_class = 'bg-'. mfn_brightness( $item_bg_color, 169 );
$item_bg_color = 'background-color:'. mfn_hex2rgba( $item_bg_color, 0.9 ) .';';
}
// image link
if( in_array( $external, array('disable','popup') ) ){
// disable details & link popup
if( ! empty($large_image_url[0]) ){
$link_before_escaped = '';
}
} elseif( $external && $ext_link ){
// link to project website
$link_before_escaped = '';
} else {
// link to project details
$link_before_escaped = '';
}
// accessibility
if ( mfn_opts_get('repetitive-links') ) {
$button_text = mfn_repetitive_link( get_permalink(), $translate['readmore'] );
}
// output -----
$output .= '';
if( $style == 'exposure' ){
// style: Exposure
$output .= $link_before_escaped;
// photo
$output .= '';
$output .= get_the_post_thumbnail( get_the_ID(), 'full', array( 'class'=>'scale-with-grid', 'itemprop'=>'image' ) );
$output .= '
';
$output .= '
';
// title
$output .= '';
$output .= '
';
$output .= '
';
$output .= '
';
$title_tag = $title_tag ? $title_tag : 'h2';
$output .= '<'. mfn_allowed_title_tag($title_tag) .' class="entry-title '. esc_attr($title_class) .'" itemprop="headline">'. wp_kses(get_the_title(), mfn_allowed_html()) .''. mfn_allowed_title_tag($title_tag) .'>';
$output .= '
';
$output .= get_the_excerpt();
$output .= '
';
$output .= '
';
$output .= '
';
$output .= '
';
$output .= '';
// details
$output .= '
';
$output .= '
';
$output .= '
';
if( $link = get_post_meta( get_the_ID(), 'mfn-post-link', true ) ){
$output .= '
';
$output .= '
'. esc_html($translate['website']) .'
';
$output .= '
';
$output .= '
';
}
if( $client = get_post_meta( get_the_ID(), 'mfn-post-client', true ) ){
$output .= '
';
$output .= '
'. esc_html($translate['client']) .'
';
$output .= ''. esc_html($client) .'
';
$output .= '';
}
if( isset( $list_meta['date'] ) ){
$output .= '
';
$output .= '
'. esc_html($translate['date']) .'
';
$output .= ''. esc_html(get_the_date()) .'
';
$output .= '';
}
$output .= '
';
$output .= '
';
$output .= '
';
} elseif( $style == 'masonry-minimal' ){
// style: Masonry Minimal
$output .= '';
$output .= '
';
$output .= mfn_post_thumbnail( get_the_ID(), 'portfolio', 'masonry-minimal', $external );
$output .= '
';
$output .= '
';
} elseif( $style == 'masonry-hover' ){
// style: Masonry Hover
$output .= '';
// desc
$output .= '
';
$output .= '
';
$title_tag = $title_tag ? $title_tag : 'h3';
$output .= '<'. mfn_allowed_title_tag($title_tag) .' class="entry-title '. esc_attr($title_class) .'" itemprop="headline">'. $link_before_escaped . wp_kses(get_the_title(), mfn_allowed_html()) .''. mfn_allowed_title_tag($title_tag) .'>';
$output .= '
';
$output .= get_the_excerpt();
$output .= '
';
$output .= '
';
if( $external != 'disable' ){
$output .= '
';
if( ! in_array( $external, array('_self','_blank') ) ){
if( ! empty($large_image_url[0]) ){
$output .= '
';
}
}
if( $ext_link ){
$output .= '
';
}
if( ! $external ){
$output .= $link_before_escaped. '
';
}
$output .= '
';
}
$output .= '
';
// photo
$output .= '
';
$output .= $link_before_escaped;
$output .= get_the_post_thumbnail( get_the_ID(), 'full', array( 'class'=>'scale-with-grid', 'itemprop'=>'image' ) );
$output .= '';
$output .= '
';
$output .= '
';
} else {
// style: default
$output .= '';
$output .= '
';
// style: List | Section Wrapper
if( $style == 'list' ){
$output .= '
';
}
// style: list | desc
if( $style == 'list' ){
$output .= '';
}
// style: default | photo
$output .= '
';
$output .= '
';
$output .= mfn_post_thumbnail( get_the_ID(), 'portfolio', $style, $external );
$output .= '
';
$output .= '
';
// style: default | desc
$output .= '
';
if( $style != 'list' ){
$output .= '
';
$title_tag = $title_tag ? $title_tag : 'h5';
$output .= '<'. mfn_allowed_title_tag($title_tag) .' class="entry-title '. esc_attr($title_class) .'" itemprop="headline">'. $link_before_escaped . wp_kses(get_the_title(), mfn_allowed_html()) .''. mfn_allowed_title_tag($title_tag) .'>';
$output .= '
'. mfn_love() .'
';
$output .= '
';
}
$output .= '
';
$output .= '
';
if( $client = get_post_meta( get_the_ID(), 'mfn-post-client', true ) ){
$output .= '- '. esc_html($translate['client']) .'
';
$output .= '- '. esc_html($client) .'
';
}
if( isset( $list_meta['date'] ) ){
$output .= '- '. esc_html($translate['date']) .'
';
$output .= '- '. esc_html(get_the_date()) .'
';
}
if( $link = get_post_meta( get_the_ID(), 'mfn-post-link', true ) ){
$output .= '- '. esc_html($translate['website']) .'
';
$output .= '- '. esc_html($translate['view']) .'
';
}
$output .= '
';
$output .= '
';
$output .= '
';
$output .= get_the_excerpt();
$output .= '
';
$output .= '
';
// style: List | end: Section Wrapper
if( $style == 'list' ){
$output .= '
';
}
$output .= '
';
}
$output .= '';
}
}
return $output;
}
}