<article id="post-<?php 
        the_ID();
        ?>
" <?php 
        post_class($class);
        ?>
><?php 
        $ids = get_metabox('gallery_image_ids');
        $video_embed = get_metabox('format_video_embed');
        $video_url = get_metabox('pretty_video_url');
        $image_url = get_metabox('preview_url');
        if (has_post_thumbnail($post->ID)) {
            if (!empty($video_url) && get_metabox('pretty_video') === 'true') {
                portfolio_image($width, $height, true, $video_url);
            } else {
                portfolio_image($width, $height);
            }
        } elseif ($ids != "false" && $ids != "") {
            portfolio_gallery($width, $height, $ids);
        } elseif (!empty($video_embed)) {
            echo apply_filters("the_content", htmlspecialchars_decode($video_embed));
        }
        ?>
					
                    
                </article><?php 
    }
    echo '</div>';
    echo '</div>';
    wp_reset_query();
}
 function shortcode_jw_recent_posts($atts, $content)
 {
     global $portAtts;
     $portAtts = $atts;
     $atts['excerpt_count'] = isset($atts['excerpt_count']) ? intval($atts['excerpt_count']) : 50;
     $more_text = !empty($atts['more_text']) ? $atts['more_text'] : (jw_option('translate_readmore') ? jw_option('translate_readmore') : __('Read More', 'designinvento'));
     $more_text_show = isset($atts['more_text_show']) ? $atts['more_text_show'] : 'false';
     $hide_meta = isset($atts['hide_meta']) ? $atts['hide_meta'] : 'false';
     $post_count = isset($atts['post_count']) ? $atts['post_count'] : '';
     $post_category_list = isset($atts['post_category_list']) ? $atts['post_category_list'] : '';
     $arrow = '<div class="carousel-arrow jw-carrow">';
     $arrow .= '<a class="carousel-prev" href="#"><i class="icon-angle-left"></i></a>';
     $arrow .= '<a class="carousel-next" href="#"><i class="icon-angle-right"></i></a>';
     $arrow .= '</div>';
     $output = '<div class="carousel-container">';
     $output .= '<div class="jw-carousel-post list_carousel">';
     $output .= '<ul class="jw-carousel">';
     $query = array('post_type' => 'post', 'posts_per_page' => $post_count);
     $cats = explode(",", $post_category_list);
     if (!empty($cats[0])) {
         $query['tax_query'] = array(array('taxonomy' => 'category', 'terms' => $cats, 'field' => 'id'));
     }
     if (!empty($atts['order'])) {
         switch ($atts['order']) {
             case "date_asc":
                 $query['orderby'] = 'date';
                 $query['order'] = 'ASC';
                 break;
             case "title_asc":
                 $query['orderby'] = 'title';
                 $query['order'] = 'ASC';
                 break;
             case "title_desc":
                 $query['orderby'] = 'title';
                 $query['order'] = 'DESC';
                 break;
             case "random":
                 $query['orderby'] = 'rand';
                 break;
         }
     }
     $imgwidth = 370;
     // START - LOOP
     query_posts($query);
     while (have_posts()) {
         the_post();
         $imgheight = $atts['image_height'];
         $output .= '<li>';
         if (get_post_format() == "video") {
             $output .= '<div class="carousel-video" style="height:' . $imgheight . 'px;">';
             ob_start();
             format_video();
             $output .= ob_get_clean();
             $output .= '</div>';
         } else {
             if (post_image_show()) {
                 ob_start();
                 portfolio_image($imgwidth, $imgheight);
                 $output .= ob_get_clean();
             }
         }
         $output .= '<div class="carousel-content">';
         if ($hide_meta === 'false') {
             $output .= '<div class="carousel-meta clearfix"><div class="date"><i class="icon-calendar-empty"></i>' . get_the_time('j M Y') . '</div><div class="comment-count"><i class="icon-comments-alt"></i>' . comment_count() . '</div></div>';
         }
         $output .= '<h3><a href="' . get_permalink() . '" class="carousel-post-title">' . get_the_title() . '</a></h3>';
         $output .= '<p>' . to_excerpt(get_the_content(), $atts['excerpt_count']) . '</p>';
         if ($more_text_show === 'true') {
             $output .= '<div class="read-more-container"><a href="' . get_permalink() . '" class="more-link">' . apply_filters("widget_title", $more_text) . '</a></div>';
         }
         $output .= '</div>';
         $output .= '</li>';
     }
     wp_reset_query();
     // END   - LOOP
     $output .= '</ul>';
     $output .= '<div class="clearfix"></div>';
     $output .= $arrow;
     $output .= '</div>';
     $output .= '</div>';
     return $output;
 }