Exemplo n.º 1
0
function loop_content()
{
    global $jw_options, $more;
    $more = 0;
    if (has_excerpt()) {
        the_excerpt();
    } elseif (has_more()) {
        the_content("");
        //echo '<a href="' . get_permalink() . '" class="more-link">' . $readMore . '</a>';
    } elseif ($jw_options['excerpt_count'] != '') {
        echo to_excerpt(strip_shortcodes(get_the_content()), $jw_options['excerpt_count']);
        //echo '<a href="' . get_permalink() . '" class="more-link">' . $readMore . '</a>';
    } else {
        echo apply_filters("the_content", strip_shortcodes(get_the_content("")));
    }
}
Exemplo n.º 2
0
 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;
 }