"", "order_by" => "", "order" => "", "category" => "", "text_length" => "", "title_tag" => "h5", "display_time" => "1", "display_comments" => "1", ); extract(shortcode_atts($args, $atts)); $headings_array = array('h2', 'h3', 'h4', 'h5', 'h6'); //get correct heading value. If provided heading isn't valid get the default one $title_tag = (in_array($title_tag, $headings_array)) ? $title_tag : $args['title_tag']; $q = new WP_Query( array('orderby' => $order_by, 'order' => $order, 'posts_per_page' => $number_of_posts, 'category_name' => $category) ); $html = ""; $html .= "
"; $html .= '
'; $html .= '
'; while ($q->have_posts()) : $q->the_post(); $_post_format = get_post_format(); $_post_classes = get_post_class(); $article_class = " class='"; foreach($_post_classes as $_post_class){ $article_class .= $_post_class . " "; } $article_class .= "'"; $html .= "
"; $featured_image_array = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); if($_post_format != 'quote' && $_post_format != 'link'){ $html .= '
'; switch ($_post_format) { case "video": $_video_type = get_post_meta(get_the_ID(), "video_format_choose", true); if($_video_type == "youtube") { $html .= ''; } elseif ($_video_type == "vimeo"){ $html .= ''; } elseif ($_video_type == "self"){ $html .= '
'; $html .= '
'; $html .= '
'; $html .= ''; $html .= '
'; } break; case "audio": $html .= ''; break; case "gallery": $html .= '
'; $html .= ''; $html .= '
'; break; default: if(!empty($featured_image_array)){ $html .= ''; } break; } $html .= '
'; $html .= '
'; $html .= '<'.$title_tag.' itemprop="name" class="q_masonry_blog_title entry_title">'; $excerpt = ($text_length > 0) ? substr(get_the_excerpt(), 0, intval($text_length)) : get_the_excerpt(); $html .= '

'.$excerpt.'...

'; $html .= ''; $html .= '
'; } else { $html .= '
'; $html .= ''; if($_post_format == "quote") { $html .= ''; }else{ $html .= ''; } $html .= '
'; if($_post_format == "quote") { $html .= '

'; $html .= '—' . get_the_title() . ''; } else { $html .= '

'; } $html .= '
'; } $html .= '
'; endwhile; wp_reset_postdata(); $html .= "
"; return $html; } add_shortcode('masonry_blog', 'masonry_blog'); }