false,
'excerpt' => true,
'featured_image' => false,
'filters' => false,
'title_tag' => false,
), $attr ) );
if( ! $query ){
$query = $wp_query;
}
if( ! $style ){
if( $_GET && key_exists('mfn-b', $_GET) ){
$style = esc_html( $_GET['mfn-b'] ); // demo
} else {
$style = mfn_opts_get( 'blog-layout', 'classic' );
}
}
if ( $query->have_posts() ){
while ( $query->have_posts() ){
$query->the_post();
// classes
$post_class = array('post-item','isotope-item','clearfix');
if( ! mfn_post_thumbnail( get_the_ID() ) ){
$post_class[] = 'no-img';
}
if( post_password_required() ){
$post_class[] = 'no-img';
}
if( in_array( $filters, array( 1, 'only-authors' ) ) ){
$post_class[] = 'author-'. mfn_slug( get_the_author_meta( 'user_login' ) );
}
$post_class = implode(' ', get_post_class( $post_class ));
// background color | style: Masonry Tiles
$bg_color = get_post_meta( get_the_ID(), 'mfn-post-bg', true );
if( $bg_color && 'masonry tiles' == $style ){
$bg_color = 'background-color:'. $bg_color .';';
} else {
$bg_color = false;
}
// accessibility
if ( mfn_opts_get('repetitive-links') ) {
$button_text = mfn_repetitive_link( get_permalink(), $translate['readmore'] );
}
// output -----
$output .= '
';
// icon | style: Masonry Tiles
if( 'masonry tiles' == $style ){
if( get_post_format() == 'video' ){
$output .= '
';
} elseif( get_post_format() == 'quote' ){
$output .= '
';
} elseif( get_post_format() == 'link' ){
$output .= '
';
} elseif( get_post_format() == 'audio' ){ // for future use
$output .= '
';
} else {
$rev_slider = get_post_meta( get_the_ID(), 'mfn-post-slider', true );
$lay_slider = get_post_meta( get_the_ID(), 'mfn-post-slider-layer', true );
if( $rev_slider || $lay_slider ){
$output .= '
';
}
}
}
// date | style: Timeline
$output .= '
'. esc_html(get_the_date()) .'
';
// photo
if( ! post_password_required() ){
if( 'masonry tiles' == $style ){
// photo | style: Masonry Tiles
$output .= '
';
$output .= '
';
$output .= get_the_post_thumbnail( get_the_ID(), 'full', array( 'class'=>'scale-with-grid', 'itemprop'=>'image' ) );
$output .= '
';
$output .= '
';
} else {
// photo | style: default
// post image
$post_format = mfn_post_thumbnail_type( get_the_ID() );
if( 'photo2' == $style ){
$featured_image = 'image';
$output .= '
'. mfn_love() .'
';
}
if( 'image' == $featured_image ){
$post_format = 'images_only';
}
$output .= '
';
$output .= '
';
$output .= mfn_post_thumbnail( get_the_ID(), 'blog', $style, $featured_image );
$output .= '
';
$output .= '
';
}
}
// desc
$bg_color = get_post_meta( get_the_ID(), 'mfn-post-bg', true );
$item_bg_class = 'bg-'. mfn_brightness( $bg_color );
if( 'photo2' == $style && $bg_color ){
$bg_color = 'background-color:'. $bg_color .';';
} else {
$bg_color = false;
}
if( $bg_color || '#ffffff' != mfn_opts_get('background-archives-post','') ){
$item_bg_class .= ' has-custom-bg';
}
$output .= '
';
$output .= '
';
// head
$output .= '
';
// meta
$show_meta = false;
$list_meta = mfn_opts_get( 'blog-meta' );
if( is_array( $list_meta ) ){
if( isset( $list_meta['author'] ) || isset( $list_meta['date'] ) || isset( $list_meta['categories'] ) ){
$show_meta = true;
}
}
if( $show_meta ){
$output .= '
';
$output .= '
';
if( isset( $list_meta['author'] ) ){
$output .= '
';
$output .= ''. esc_html($translate['published']) .' ';
$output .= ' ';
$output .= ''. esc_html(get_the_author_meta('display_name')) .'';
$output .= ' ';
}
if( isset( $list_meta['date'] ) ){
$output .= '
';
if( isset( $list_meta['author'] ) ){
$output .= ''. esc_html($translate['at']) .' ';
}
$output .= ' ';
$output .= ''. esc_html(get_the_date()) .'';
$output .= '';
}
// .post-comments | style: Masonry Tiles
if( 'masonry tiles' == $style && comments_open() && mfn_opts_get( 'blog-comments' ) ){
$output .= '
';
$output .= ' ';
$output .= '
';
}
$output .= '
';
if( isset( $list_meta['categories'] ) ){
$output .= '
';
$output .= '
'. esc_html($translate['categories']) .' ';
$output .= '
'. get_the_category_list() .'
';
$output .= '
';
}
$output .= '
';
}
// .post-footer | style: Photo
if( 'photo' == $style ){
$output .= '';
}
$output .= '
';
// title
$output .= '
';
if( get_post_format() == 'quote' ){
// quote
$output .= '
'. wp_kses(get_the_title(), mfn_allowed_html()) .'
';
} elseif( get_post_format() == 'link' ){
// link
$link = get_post_meta(get_the_ID(), 'mfn-post-link', true);
$output .= '
';
$output .= '
';
$output .= '
'. wp_kses(get_the_title(), mfn_allowed_html()) .'
';
$output .= '
'. esc_html($link) .'';
$output .= '
';
} else {
// default
if( ! $title_tag ){
$title_tag = mfn_opts_get('blog-title-tag', 2);
}
$output .= '
'. wp_kses(get_the_title(), mfn_allowed_html()) .'';
}
$output .= '
';
// content
if( $excerpt ){
$output .= '
'. get_the_excerpt() .'
';
}
// .post-footer | style NOT: Photo, Masonry Tiles
if( ! in_array( $style, array('photo','photo2','masonry tiles') ) && ( !empty(mfn_love()) || ( comments_open() && mfn_opts_get( 'blog-comments' ) ) || !empty($attr['more']) ) ){
$output .= '';
}
// .post-footer | style: Photo 2
if( 'photo2' == $style ){
if( isset( $list_meta['author'] ) || isset( $list_meta['date'] ) ){
$output .= '';
}
}
$output .= '
';
$output .= '
';
$output .= '
';
// echo immediately for some plugins
if( $echo ){
echo $output;
$output = '';
}
}
}
return $output;
}
}