protected function WT_VCSC_BlogList(&$wt_query, $atts, $current) { extract($atts); $anim_class_left = $this->wt_sc->getWTCSSAnimationClass($css_animation, $anim_type); $anim_class_right = $this->wt_sc->getWTCSSAnimationClass($css_animation_right, $anim_type); $anim_data_left = $this->wt_sc->getWTCSSAnimationData($css_animation, $anim_delay); $anim_data_right = $this->wt_sc->getWTCSSAnimationData($css_animation_right, $anim_delay); if ($grid == 'true') { $class = array('half', 'third', 'fourth', 'sixth'); $cssColumn = $class[$columns - 2]; if ($cssColumn == 'half') { $css = 'col-lg-6 col-md-6 col-sm-6'; } elseif ($cssColumn == 'third') { $css = 'col-lg-4 col-md-4 col-sm-4'; } elseif ($cssColumn == 'fourth') { $css = 'col-lg-3 col-md-3 col-sm-3'; } elseif ($cssColumn == 'sixth') { $css = 'col-lg-2 col-md-2 col-sm-2'; } } else { $start = ($current - 1) * $posts_per_column + 1; $end = $current * $posts_per_column; if ($wt_query->post_count < $start) { return ''; } } //global $layout; $layout = 'full'; $output = ''; // If sortable blog shortcode if ($masonry == 'true') { wp_enqueue_script('jquery-isotope'); wp_enqueue_script('jquery-init-isotope'); $output .= '<div class="wt_isotope">'; $element = 'wt_element '; } else { $element = ''; } $i = 0; // Get global $post var global $post; if ($wt_query->have_posts()) { while ($wt_query->have_posts()) { $i++; $anim_class = ''; $anim_data = ''; if ($grid == 'false') { if ($i < $start) { continue; } if ($i > $end) { break; } } $wt_query->the_post(); if ($grid == 'true' && $columns != 1) { $output .= "<div class=\"{$element}{$css}\">"; } if ($columns == 1) { if ($i & 1) { $anim_class = $anim_class_left; $anim_data = $anim_data_left; } else { $anim_class = $anim_class_right; $anim_data = $anim_data_right; } $output .= '<article data-order="' . $i . '" id="post-' . get_the_ID() . '" class="blogEntry col-lg-12 col-md-12 col-sm-12' . $anim_class . ' clearfix"' . $anim_data . '><span class="note-arrow"></span>'; } else { $output .= '<article data-order="' . $i . '" id="post-' . get_the_ID() . '" class="blogEntry clearfix"><span class="note-arrow"></span>'; } /* Display featured entry */ if ($featured_entry == 'true') { $output .= '<header class="blogEntry_frame entry_' . $featured_entry_type . '">'; $thumbnail_type = get_post_meta($post->ID, '_thumbnail_type', true); // Default sizes for featured image / slide $width = 705; $height = 380; switch ($thumbnail_type) { case "timage": $output .= wt_theme_generator('wt_blog_featured_image', $featured_entry_type, $layout, $width, $height); break; case "tvideo": $video_link = get_post_meta($post->ID, '_featured_video', true); $output .= '<div class="blog-thumbnail-video">'; $output .= wt_video_featured($video_link, $featured_entry_type, $layout); $output .= '</div>'; break; case "tplayer": wp_enqueue_script('mediaelementjs-scripts'); $player_link = get_post_meta($post->ID, '_thumbnail_player', true); $output .= '<div class="blog-thumbnail-player">'; $output .= wt_media_player($featured_entry_type, $layout, $player_link); $output .= '</div>'; break; case "tslide": $output .= '<div class="blog-thumbnail-slide">'; $output .= wt_get_slide($featured_entry_type, $layout, $width, $height); $output .= '</div>'; break; } $output .= '</header>'; } $output .= '<div class="wt_dates"><div class="entry_date">'; $output .= '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '"><span class="day">' . get_the_time('d') . '</span><span class="month">' . get_the_time('M') . '</span></a></div>'; $output .= '</div>'; /* Display description (post excerpt / content) */ if ($excerpt == 'false') { $output .= '<div class="blogEntry_content">'; if ($title == 'true') { $output .= '<h3 class="blogEntry_title"><a href="' . get_permalink() . '" rel="bookmark" title="' . sprintf(__("Permanent Link to %s", 'wt_vcsc'), get_the_title()) . '">' . get_the_title() . '</a></h3>'; } if ($meta == 'true') { $output .= '<footer class="blogEntry_metadata">'; $output .= wt_theme_generator('wt_blog_meta'); $output .= '</footer>'; } if ($read_more == 'true') { $readmore_link = '<p class="readMore"><a href="' . get_permalink($id) . '" title="' . $read_more_text . '" rel="bookmark" class="read_more_link">' . $read_more_text . ' <span class="wt-readmore-rarr">»</span></a></p>'; $output .= apply_filters('wt_readmore_link', $readmore_link); } $output .= '</div>'; // End blogEntry_content div } else { /* If description is YES */ $output .= '<div class="blogEntry_content">'; if ($title == 'true') { $output .= '<h3 class="blogEntry_title"><a href="' . get_permalink() . '" rel="bookmark" title="' . sprintf(__("Permanent Link to %s", 'wt_vcsc'), get_the_title()) . '">' . get_the_title() . '</a></h3>'; } if ($meta == 'true') { $output .= '<footer class="blogEntry_metadata">'; $output .= wt_theme_generator('wt_blog_meta'); $output .= '</footer>'; } /* Display all post content or post excerpt */ if ($full == 'true') { global $more; $more = 0; $content = get_the_content(__("Read More", 'wt_vcsc'), false); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $output .= $content; } else { /* $content = get_the_excerpt(); $content = apply_filters('the_excerpt', $content); $output .= '<div class="blogEntry_excerpt">'.$content.'</div>'; $output .= '<p class="readMore"><a class="read_more_link" href="'.get_permalink().'">'. __('Read more »','wt_vcsc').'</a></p>'; */ $content = WT_VCSC_Excerpt($excerpt_length, $read_more, $read_more_text); $output .= '<div class="blogEntry_excerpt">' . $content . '</div>'; } $output .= '</div>'; // End blogEntry_content div if ($featured_entry_type == 'left') { $output .= '<div class="wt_clearboth"></div>'; } } $output .= '</article>'; if ($grid == 'true' && $columns != 1) { $output .= '</div>'; } } } return $output; }
protected function WT_VCSC_PortfolioList($options, $id) { global $wp_filter; $the_content_filter_backup = $wp_filter['the_content']; $options = shortcode_atts(array('columns' => 4, 'grid_spaces' => 'false', 'overlay_desc' => 'false', 'max' => -1, 'pagination' => 'false', 'pagination_align' => 'center', 'sortable' => 'false', 'carousel' => 'false', 'auto_slide' => 0, 'carousel_nav' => 'false', 'title' => 'true', 'title_linkable' => 'true', 'excerpt' => 'false', 'excerpt_length' => 15, 'full' => 'false', 'category' => 'true', 'group' => 'true', 'ids' => '', 'cat' => '', 'cat__not' => '', 'order' => 'DESC', 'orderby' => 'date', 'read_more' => 'true', 'read_more_text' => __('Read more', 'wt_vcsc')), $options); extract($options); $output = ''; $rel_group = 'portfolio_' . $id; // for lightbox group if ($read_more == 'true') { $read_more = true; } else { $read_more = false; } // Automatically disable sortable or pagination if they all are true by mistake if ($carousel == "true") { $sortable = 'false'; $pagination = 'false'; } if ($sortable == "true") { $pagination = 'false'; } if ($pagination == 'true') { global $wp_version; if (is_front_page() && version_compare($wp_version, "3.1", '>=')) { //fix wordpress 3.1 paged query $paged = get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1); } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } } else { $paged = NULL; } // Display only selected portfolios if ($ids) { $portfolio_ids = explode(',', $ids); } else { $portfolio_ids = NULL; } // Include categories if (!empty($cat)) { $include_categories = array('taxonomy' => 'wt_portfolio_category', 'field' => 'slug', 'terms' => explode(',', $cat), 'operator' => 'IN'); } else { $include_categories = ''; } // Exclude categories if (!empty($cat__not)) { $exclude_categories = array('taxonomy' => 'wt_portfolio_category', 'field' => 'slug', 'terms' => explode(',', $cat__not), 'operator' => 'NOT IN'); } else { $exclude_categories = ''; } $wt_query = new WP_Query(array('post_type' => 'wt_portfolio', 'posts_per_page' => $max, 'paged' => $paged, 'order' => $order, 'orderby' => $orderby, 'post__in' => $portfolio_ids, 'tax_query' => array('relation' => 'AND', $include_categories, $exclude_categories))); $i = 1; $order = 0; while ($wt_query->have_posts()) { $order++; $wt_query->the_post(); $terms = get_the_terms(get_the_id(), 'wt_portfolio_category'); $terms_slug = array(); if (is_array($terms)) { foreach ($terms as $term) { $terms_slug[] = $term->slug; } } if (has_post_thumbnail()) { $image_id = get_post_thumbnail_id(get_the_id()); $image = wp_get_attachment_image_src($image_id, 'full', true); $type = get_post_meta(get_the_id(), '_portfolio_type', true); $iframe = ''; $video_width = $video_height = ''; // if portfolio type - image if ($type == 'image') { // if no large image link is set then get the featured image $href = get_post_meta(get_the_id(), '_image', true); if (empty($href)) { $href = $image[0]; } $icon = '<i class="fa-picture-o"></i>'; $lightbox = ' lightbox'; if ($group == 'true') { $rel = ' data-rel="lightbox[' . $rel_group . ']"'; } else { $rel = ''; } // if portfolio type - video } elseif ($type == 'video') { // if no video link is set then get the featured image $href = get_post_meta(get_the_id(), '_video', true); if (empty($href)) { $href = $image[0]; } $video_width = get_post_meta(get_the_id(), '_video_width', true); $video_height = get_post_meta(get_the_id(), '_video_height', true); if ($video_width) { $video_width = '?width=' . $video_width . ''; } if ($video_height) { if ($video_width) { $video_height = '&height=' . $video_height . ''; } else { $video_height = '?height=' . $video_height . ''; } } $icon = '<i class="fa-youtube-play"></i>'; $lightbox = ' lightbox'; if ($group == 'true') { $rel = ' data-rel="lightbox[' . $rel_group . ']"'; } else { $rel = ''; } // if portfolio type - link } elseif ($type == 'link') { $link = get_post_meta(get_the_ID(), '_portfolio_link', true); $href = wt_get_superlink($link); $link_target = get_post_meta(get_the_ID(), '_portfolio_link_target', true); $link_target = $link_target ? $link_target : '_self'; $icon = '<i class="fa-link"></i>'; $lightbox = ''; $rel = ''; // if portfolio type - document } else { $href = get_permalink(); $link_target = get_post_meta(get_the_ID(), '_doc_target', true); $link_target = $link_target ? $link_target : '_self'; $icon = '<i class="fa-file-text"></i>'; $lightbox = ''; $rel = ''; } } /* End if (has_post_thumbnail() */ if ($carousel == 'true') { $output .= '<div class="item">'; } if ($columns == 1) { $output .= '<article data-order="' . $order . '" id="post-' . get_the_ID() . '" class="portEntry">'; $output .= '<header class="wt_portofolio_item wt_two_third ' . implode(' ', $terms_slug) . '">'; } else { // $columns==2 || $columns==3 || $columns==4 || $columns==6 $output .= '<article data-order="' . $order . '" id="post-' . get_the_ID() . '" class="portEntry wt_portofolio_item'; $output .= ' ' . implode(' ', $terms_slug) . '">'; $output .= '<div class="wt_portofolio_container">'; } switch ($columns) { case 1: // portfolio one column $width = '620px'; $height = '312px'; break; case 2: // portfolio two columns $width = '730px'; $height = '465px'; $width_inline = '730'; $height_inline = '654'; break; case 3: // portfolio three columns $width = '730px'; $height = '465px'; $width_inline = '730'; $height_inline = '465'; break; case 6: // portfolio six columns // portfolio six columns case 5: // portfolio five columns // portfolio five columns case 4: // portfolio four columns // portfolio four columns default: $width = '480px'; $height = '305px'; $width_inline = '480'; $height_inline = '305'; } if (has_post_thumbnail()) { $output .= '<figure class="wt_image_frame">'; $output .= '<span class="wt_image_holder">'; $output .= '<img src="' . aq_resize(wt_get_image_src($image[0]), $width, $height, true) . '" alt="' . get_the_title() . '" width="' . $width_inline . '" height="' . $height_inline . '" />'; if ($overlay_desc == 'false') { // if overlay title / excerpt is false $output .= '<span class="wt_image_overlay"></span>'; $output .= '<a class="wt_icon_lightbox" ' . (isset($link_target) ? 'target="' . $link_target . '" ' : '') . ' ' . $rel . ' href="' . $href . $video_width . $video_height . '" title="' . get_the_title() . '">' . $icon . '</a>'; } $output .= '</span>'; $output .= '</figure>'; } /* End if (has_post_thumbnail() */ if ($columns == 1) { $output .= '</header>'; // End header - "wt_portofolio_item" $output .= '<div class="wt_portofolio_item wt_one_third last'; $output .= ' ' . $term->slug . '">'; } if ($columns != 1 && ($excerpt == 'true' || $title == 'true' || $category == 'true' || $read_more == true)) { $output .= '<div class="wt_portofolio_details">'; if ($overlay_desc == 'true') { // if overlay title / excerpt is true $output .= '<a class="wt_icon_lightbox" ' . (isset($link_target) ? 'target="' . $link_target . '" ' : '') . ' ' . $rel . ' href="' . $href . $video_width . $video_height . '" title="' . get_the_title() . '">' . $icon . '</a>'; } } // If portfolio title if ($title == 'true') { if ($title_linkable == 'true') { $output .= '<h4 class="wt_portfolio_title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h4>'; } else { $output .= '<h4 class="wt_portfolio_title">' . get_the_title() . '</h4>'; } } // If excerpt, category or read_more then build "wt_portofolio_det" wrapper if ($excerpt == 'true' || $category == 'true' || $read_more == true) { $output .= '<div class="wt_portofolio_det">'; } // if category is set to Yes if ($category == 'true') { $output .= '<p class="wt_portfolioCategory">' . $term->name . '</p>'; } // if excerpt is set to Yes if ($excerpt == 'true') { /* Display all post content or post excerpt */ if ($full == 'true') { $read_more = false; $content = get_the_content(); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $output .= $content; } else { $content = WT_VCSC_Excerpt($excerpt_length, false, $read_more_text); $output .= '<div class="wt_portfolio_excerpt">' . $content . '</div>'; } } // if read_more is set to Yes if ($read_more == true) { $more_link = wt_get_superlink(get_post_meta(get_the_id(), '_portfolio_link', true), get_permalink()); $more_link_target = get_post_meta(get_the_ID(), '_portfolio_link_target', true); $more_link_target = $more_link_target ? $more_link_target : '_self'; $readmore_link = '<p class="wt_portf_readmore"><a href="' . $more_link . '" target="' . $more_link_target . '" title="' . $read_more_text . '" rel="bookmark" class="read_more_link">' . $read_more_text . ' <span class="wt-readmore-rarr">»</span></a></p>'; $output .= apply_filters('wt_readmore_link', $readmore_link); } if ($excerpt == 'true' || $category == 'true' || $read_more == true) { $output .= '</div>'; // End div - "wt_portofolio_det" } if ($columns != 1 && ($excerpt == 'true' || $title == 'true' || $category == 'true' || $read_more == true)) { $output .= '</div>'; // End div - "wt_portofolio_details" } if ($columns == 1) { $output .= '</div>'; // End div - "wt_portofolio_item" } else { // $columns==2 || $columns==3 || $columns==4 || $columns==6 $output .= '</div>'; // End div - "wt_portofolio_container" } $output .= '</article>'; // End portfolio article if ($carousel == 'true') { $output .= '</div>'; // End "item" div } } if ($carousel == 'true') { $output .= '</div>'; // End "wt_owl_carousel" div $output .= '</div>'; // End "wt_port_carousel" div } if ($pagination == 'true' && $carousel == 'false') { ob_start(); WT_VCSC_PortfolioPageNavi('', '', $wt_query, $paged, $pagination_align); $output .= ob_get_clean(); } wp_reset_postdata(); $wp_filter['the_content'] = $the_content_filter_backup; return $output; }