protected function content($atts, $content = null)
 {
     $title = $width = $el_class = $output = $tax_terms = $items = $el_position = '';
     extract(shortcode_atts(array('title' => '', 'portfolio_type' => 'basic', 'display_type' => 'standard', 'columns' => '4', 'show_title' => 'yes', 'show_client' => 'yes', 'show_excerpt' => 'yes', "excerpt_length" => '20', 'item_count' => '-1', 'category' => '', 'pagination' => 'no', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
     // CATEGORY SLUG MODIFICATION
     if ($category == "All") {
         $category = "all";
     }
     if ($category == "all") {
         $category = '';
     }
     $category_slug = str_replace('_', '-', $category);
     // PORTFOLIO QUERY SETUP
     global $post, $wp_query;
     $paged = get_query_var('paged') ? get_query_var('paged') : 1;
     $portfolio_args = array('post_type' => 'portfolio', 'post_status' => 'publish', 'paged' => $paged, 'portfolio-category' => $category_slug, 'posts_per_page' => $item_count);
     $portfolio_items = new WP_Query($portfolio_args);
     $count = 0;
     // LIST CLASS SETUP BASED ON SELECTED OPTIONS
     $list_class = '';
     if ($display_type == "bordered" || $display_type == "bordered_gallery") {
         $list_class .= 'bordered-items ';
     }
     if ($portfolio_type == "masonry") {
         $list_class .= 'masonry-items';
     }
     $items .= '<ul class="portfolio-items filterable-items ' . $list_class . ' clearfix">';
     // PORTFOLIO LOOP
     while ($portfolio_items->have_posts()) {
         $portfolio_items->the_post();
         // META VARIABLES
         $thumb_image = $video = $item_class = $link_config = '';
         $thumb_width = 420;
         $thumb_height = 315;
         $video_height = 315;
         $bordered_thumb_width = 408;
         $bordered_thumb_height = 303;
         $bordered_video_height = 303;
         if ($portfolio_type == "masonry") {
             $thumb_height = NULL;
             $video_height = 315;
             $bordered_thumb_height = NULL;
         }
         $thumb_type = get_post_meta($post->ID, 'sf_thumbnail_type', true);
         $thumb_image = rwmb_meta('sf_thumbnail_image', 'type=image&size=full');
         $thumb_video = get_post_meta($post->ID, 'sf_thumbnail_video_url', true);
         $thumb_gallery = rwmb_meta('sf_thumbnail_gallery', 'type=image&size=thumb-image');
         $thumb_link_type = get_post_meta($post->ID, 'sf_thumbnail_link_type', true);
         $thumb_link_url = get_post_meta($post->ID, 'sf_thumbnail_link_url', true);
         $thumb_lightbox_thumb = rwmb_meta('sf_thumbnail_image', 'type=image&size=large');
         $thumb_lightbox_image = rwmb_meta('sf_thumbnail_link_image', 'type=image&size=large');
         $thumb_lightbox_video_url = get_post_meta($post->ID, 'sf_thumbnail_link_video_url', true);
         foreach ($thumb_image as $detail_image) {
             $thumb_img_url = $detail_image['url'];
             break;
         }
         if (!$thumb_image) {
             $thumb_image = get_post_thumbnail_id();
             $thumb_img_url = wp_get_attachment_url($thumb_image, 'full');
         }
         $item_title = get_the_title();
         $item_client = get_post_meta($post->ID, 'sf_portfolio_client', true);
         $permalink = get_permalink();
         $custom_excerpt = get_post_meta($post->ID, 'sf_custom_excerpt', true);
         $post_excerpt = '';
         if ($custom_excerpt != '') {
             $post_excerpt = custom_excerpt($custom_excerpt, $excerpt_length);
         } else {
             $post_excerpt = excerpt($excerpt_length);
         }
         $thumb_lightbox_img_url = wp_get_attachment_url($thumb_lightbox_image, 'full');
         $post_terms = get_the_terms($post->ID, 'portfolio-category');
         $term_slug = " ";
         if (!empty($post_terms)) {
             foreach ($post_terms as $post_term) {
                 $term_slug = $term_slug . strtolower(str_replace(' ', '-', $post_term->name)) . ' ';
             }
         }
         // COLUMN OPTION VARIABLES
         $item_class = $item_icon = "";
         if ($columns == "1") {
             $item_class = "one-col ";
             $excerpt = get_the_excerpt();
             $thumb_width = 940;
             $thumb_height = NULL;
             $video_height = 528;
             $bordered_thumb_width = 928;
             $bordered_thumb_height = NULL;
             $bordered_video_height = 522;
         } else {
             if ($columns == "2") {
                 $item_class = "eight ";
             } else {
                 if ($columns == "3") {
                     $item_class = "thirds ";
                 } else {
                     if ($columns == "4") {
                         $item_class = "four ";
                     }
                 }
             }
         }
         // DISPLAY TYPE VARIABLES
         if ($display_type == "standard") {
             $item_class .= "standard ";
         } else {
             if ($display_type == "bordered") {
                 $item_class .= "bordered ";
             } else {
                 if ($display_type == "gallery") {
                     $item_class .= "gallery ";
                 } else {
                     if ($display_type == "bordered_gallery") {
                         $item_class .= "gallery bordered ";
                     }
                 }
             }
         }
         if ($thumb_type == "image") {
             $item_class .= "image-item";
         }
         // LINK TYPE VARIABLES
         if ($thumb_link_type == "link_to_url") {
             $link_config = 'href="' . $thumb_link_url . '" class="link-to-url"';
             $item_icon = "link";
         } else {
             if ($thumb_link_type == "link_to_url_nw") {
                 $link_config = 'href="' . $thumb_link_url . '" class="link-to-url" target="_blank"';
                 $item_icon = "link";
             } else {
                 if ($thumb_link_type == "lightbox_thumb") {
                     $link_config = 'href="' . $thumb_img_url . '" class="view"';
                     $item_icon = "search";
                 } else {
                     if ($thumb_link_type == "lightbox_image") {
                         $lightbox_image_url = '';
                         foreach ($thumb_lightbox_image as $image) {
                             $lightbox_image_url = $image['full_url'];
                         }
                         $link_config = 'href="' . $lightbox_image_url . '" class="view"';
                         $item_icon = "search";
                     } else {
                         if ($thumb_link_type == "lightbox_video") {
                             $link_config = 'href="' . $thumb_lightbox_video_url . '" class="fancybox-media"';
                             $item_icon = "facetime-video";
                         } else {
                             $link_config = 'href="' . $permalink . '" class="link-to-post"';
                             $item_icon = "file";
                         }
                     }
                 }
             }
         }
         $items .= '<li data-id="id-' . $count . '" class="clearfix portfolio-item ' . $item_class . ' columns' . $term_slug . '">';
         $items .= '<figure>';
         // THUMBNAIL MEDIA TYPE SETUP
         if ($thumb_type == "video") {
             if ($display_type == "bordered" || $display_type == "bordered_gallery") {
                 $video = video_embed($thumb_video, $bordered_thumb_width, $bordered_video_height);
             } else {
                 $video = video_embed($thumb_video, $thumb_width, $video_height);
             }
             $items .= $video;
         } else {
             if ($thumb_type == "slider") {
                 $items .= '<div class="flexslider thumb-slider"><ul class="slides">';
                 foreach ($thumb_gallery as $image) {
                     $items .= "<li><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' /></li>";
                 }
                 $items .= '</ul><div class="open-item"><a ' . $link_config . '><i class="icon-plus"></i></a></div></div>';
             } else {
                 if ($display_type == "bordered" || $display_type == "bordered_gallery") {
                     $image = aq_resize($thumb_img_url, $bordered_thumb_width, $bordered_thumb_height, true, false);
                 } else {
                     $image = aq_resize($thumb_img_url, $thumb_width, $thumb_height, true, false);
                 }
                 if ($image) {
                     $items .= '<a ' . $link_config . '>';
                     $items .= '<div class="overlay"><div class="thumb-info">';
                     if ($display_type == "gallery" || $display_type == "bordered_gallery") {
                         $items .= '<h4>' . $item_title . '</h4>';
                         $items .= '<i class="icon-' . $item_icon . ' small-icon"></i>';
                     } else {
                         $items .= '<i class="icon-' . $item_icon . '"></i>';
                     }
                     $items .= '</div></div>';
                     $items .= '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $item_title . '" />';
                     $items .= '</a>';
                 }
             }
         }
         $items .= '</figure>';
         // ITEM INFO SETUP
         if ($display_type != "gallery" && $display_type != "bordered_gallery") {
             $items .= '<div class="portfolio-item-details">';
             if ($show_title == "yes") {
                 $items .= '<h4 class="portfolio-item-title"><a ' . $link_config . '>' . $item_title . '</a></h4>';
             }
             if ($show_client == "yes" && $item_client) {
                 $items .= '<span class="portfolio-client-title">' . $item_client . '</span>';
             }
             if ($show_excerpt == "yes") {
                 $items .= '<div class="portfolio-item-excerpt">' . $post_excerpt . '</div>';
             }
             $items .= '</div>';
         }
         $items .= '</li>';
         $count++;
     }
     wp_reset_postdata();
     $items .= '</ul>';
     // PAGINATION
     if ($pagination == "yes") {
         $items .= '<div class="pagination-wrap full-width">';
         $items .= pagenavi($portfolio_items);
         $items .= '</div>';
     }
     // PAGE BUILDER OUPUT
     $el_class = $this->getExtraClass($el_class);
     $width = wpb_translateColumnWidthToSpan($width);
     $output .= "\n\t" . '<div class="wpb_portfolio_widget wpb_content_element ' . $width . $el_class . '">';
     $output .= "\n\t\t" . '<div class="wpb_wrapper portfolio-wrap">';
     $output .= $title != '' ? "\n\t\t\t" . '<div class="heading-wrap"><h2 class="wpb_heading">' . $title . '</h2></div>' : '';
     $output .= "\n\t\t\t\t" . $items;
     $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper');
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     global $include_isotope;
     global $has_portfolio;
     $include_isotope = true;
     $has_portfolio = true;
     return $output;
 }
    function widget($args, $instance)
    {
        global $post;
        extract($args);
        // Widget Options
        $title = apply_filters('widget_title', $instance['title']);
        // Title
        $post_id = $instance['post_id'];
        // Post ID
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $infocus_post = get_post($post_id);
        ?>
			
			<div class="infocus-item">
				
				<?php 
        $post_title = $infocus_post->post_title;
        $post_permalink = get_post_permalink($infocus_post);
        $thumb_image = rwmb_meta('sf_thumbnail_image', 'type=image&size=full', $post_id);
        $thumb_video = get_post_meta($post_id, 'sf_thumbnail_video_url', true);
        foreach ($thumb_image as $detail_image) {
            $thumb_img_url = $detail_image['url'];
            break;
        }
        if (!$thumb_image) {
            $thumb_image = get_post_thumbnail_id($post_id);
            $thumb_img_url = wp_get_attachment_url($thumb_image, 'full');
        }
        $image = aq_resize($thumb_img_url, 300, 225, true, false);
        ?>
				<figure>
					<?php 
        if ($thumb_video != "") {
            ?>
						<?php 
            echo video_embed($thumb_video, 300, 200);
            ?>
					<?php 
        } else {
            if ($image) {
                ?>
					<a href="<?php 
                echo $post_permalink;
                ?>
" class="infocus-image">
						<div class="overlay">
							<div class="thumb-info">
								<i class="icon-file-alt"></i>
							</div>
						</div>
						<img src="<?php 
                echo $image[0];
                ?>
" width="<?php 
                echo $image[1];
                ?>
" height="<?php 
                echo $image[2];
                ?>
" />
					</a>
					<?php 
            }
        }
        ?>
				</figure>
								
				<div class="infocus-title clearfix">
					<h5><a href="<?php 
        echo $post_permalink;
        ?>
" title="<?php 
        echo $post_title;
        ?>
"><?php 
        echo $post_title;
        ?>
</a></h5>
					<div class="comments-likes">
					<?php 
        if (function_exists('lip_love_it_link')) {
            echo lip_love_it_link($post_id, '<i class="icon-heart"></i>', '<i class="icon-heart"></i>', false);
        }
        ?>
					</div>
				</div>
				
			</div>
							
			<?php 
        echo $after_widget;
    }
Beispiel #3
0
                if ($thumb_link_type == "lightbox_video") {
                    $link_config = 'href="' . $thumb_lightbox_video_url . '" class="fancybox-media"';
                    $item_icon = "facetime-video";
                } else {
                    $link_config = 'href="' . $post_permalink . '" class="link-to-post"';
                    $item_icon = "file-alt";
                }
            }
        }
    }
}
// THUMBNAIL MEDIA TYPE SETUP
if ($thumb_type != "none") {
    $item_figure .= '<figure>';
    if ($thumb_type == "video") {
        $video = video_embed($thumb_video, $thumb_width, $video_height);
        $item_figure .= $video;
    } else {
        if ($thumb_type == "slider") {
            $item_figure .= '<div class="flexslider thumb-slider"><ul class="slides">';
            foreach ($thumb_gallery as $image) {
                $item_figure .= "<li><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' /></li>";
            }
            $item_figure .= '</ul><div class="open-item"><a ' . $link_config . '><i class="icon-plus"></i></a></div></div>';
        } else {
            $image = aq_resize($thumb_img_url, $thumb_width, $thumb_height, true, false);
            if ($image) {
                $item_figure .= '<a ' . $link_config . '>';
                if ($blog_type == "masonry") {
                    $item_figure .= '<div class="overlay"><div class="thumb-info">';
                    $item_figure .= '<i class="icon-' . $item_icon . '"></i>';
Beispiel #4
0
 protected function content($atts, $content = null)
 {
     $title = $category = $item_class = $excerpt_length = $width = $el_class = $output = $filter = $items = $el_position = '';
     extract(shortcode_atts(array('title' => '', 'show_title' => 'yes', 'show_excerpt' => 'yes', "excerpt_length" => '20', "item_count" => '12', "show_details" => 'yes', "category" => 'all', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
     // CATEGORY SLUG MODIFICATION
     if ($category == "All") {
         $category = "all";
     }
     if ($category == "all") {
         $category = '';
     }
     $category_slug = str_replace('_', '-', $category);
     global $post, $wp_query;
     $paged = get_query_var('paged') ? get_query_var('paged') : 1;
     $args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => $paged, 'category_name' => $category_slug, 'posts_per_page' => $item_count);
     $blog_items = query_posts($args);
     $count = 0;
     if (have_posts()) {
         $items .= '<ul class="blog-items carousel-items clearfix">';
         while (have_posts()) {
             the_post();
             $item_title = get_the_title();
             $post_author = get_the_author_link();
             $post_date = get_the_date();
             $post_comments = get_comments_number();
             $thumb_type = get_post_meta($post->ID, 'coope_thumbnail_type', true);
             $thumb_image = rwmb_meta('coope_thumbnail_image', 'type=image&size=full');
             $thumb_video = get_post_meta($post->ID, 'coope_thumbnail_video_url', true);
             $thumb_gallery = rwmb_meta('coope_thumbnail_gallery', 'type=image&size=thumb-image');
             $thumb_link_type = get_post_meta($post->ID, 'coope_thumbnail_link_type', true);
             $thumb_link_url = get_post_meta($post->ID, 'coope_thumbnail_link_url', true);
             $thumb_lightbox_thumb = rwmb_meta('coope_thumbnail_image', 'type=image&size=large');
             $thumb_lightbox_image = rwmb_meta('coope_thumbnail_link_image', 'type=image&size=large');
             $thumb_lightbox_video_url = get_post_meta($post->ID, 'coope_thumbnail_link_video_url', true);
             foreach ($thumb_image as $detail_image) {
                 $thumb_img_url = $detail_image['url'];
                 break;
             }
             if (!$thumb_image) {
                 $thumb_image = get_post_thumbnail_id();
                 $thumb_img_url = wp_get_attachment_url($thumb_image, 'full');
             }
             $item_title = get_the_title();
             $permalink = get_permalink();
             $custom_excerpt = get_post_meta($post->ID, 'coope_custom_excerpt', true);
             $post_excerpt = '';
             if ($custom_excerpt != '') {
                 $post_excerpt = custom_excerpt($custom_excerpt, $excerpt_length);
             } else {
                 $post_excerpt = excerpt($excerpt_length);
             }
             $thumb_lightbox_img_url = wp_get_attachment_url($thumb_lightbox_image, 'full');
             if ($thumb_link_type == "link_to_url") {
                 $link_config = 'href="' . $thumb_link_url . '" class="link-to-url"';
                 $item_icon = "link";
             } else {
                 if ($thumb_link_type == "link_to_url_nw") {
                     $link_config = 'href="' . $thumb_link_url . '" class="link-to-url" target="_blank"';
                     $item_icon = "link";
                 } else {
                     if ($thumb_link_type == "lightbox_thumb") {
                         $link_config = 'href="' . $thumb_img_url . '" class="view"';
                         $item_icon = "search";
                     } else {
                         if ($thumb_link_type == "lightbox_image") {
                             $lightbox_image_url = '';
                             foreach ($thumb_lightbox_image as $image) {
                                 $lightbox_image_url = $image['full_url'];
                             }
                             $link_config = 'href="' . $lightbox_image_url . '" class="view"';
                             $item_icon = "search";
                         } else {
                             if ($thumb_link_type == "lightbox_video") {
                                 $link_config = 'href="' . $thumb_lightbox_video_url . '" class="fancybox-media"';
                                 $item_icon = "facetime-video";
                             } else {
                                 $link_config = 'href="' . $permalink . '" class="link-to-post"';
                                 $item_icon = "file";
                             }
                         }
                     }
                 }
             }
             if ($thumb_type == "image") {
                 $item_class .= "image-item";
             }
             $items .= '<li data-id="id-' . $count . '" class="clearfix recent-post four columns ' . $item_class . '">';
             $items .= '<figure>';
             // THUMBNAIL MEDIA TYPE SETUP
             if ($thumb_type == "video") {
                 $video = video_embed($thumb_video, 220, 165);
                 $items .= $video;
             } else {
                 if ($thumb_type == "slider") {
                     $items .= '<div class="flexslider thumb-slider"><ul class="slides">';
                     foreach ($thumb_gallery as $image) {
                         $alt = $image['alt'];
                         if (!$alt) {
                             $alt = $image['title'];
                         }
                         $items .= "<li><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$alt}' /></li>";
                     }
                     $items .= '</ul><div class="open-item"><a ' . $link_config . '><i class="icon-plus"></i></a></div></div>';
                 } else {
                     $image = aq_resize($thumb_img_url, 420, 315, true, false);
                     $items .= '<a ' . $link_config . '>';
                     $items .= '<div class="overlay"><div class="thumb-info">';
                     if (comments_open()) {
                         $items .= '<div class="overlay-comments"><i class="icon-comment"></i><span>' . $post_comments . '</span></div>';
                     }
                     if (function_exists('lip_love_it_nolink')) {
                         $items .= lip_love_it_nolink(get_the_ID(), '<i class="icon-heart"></i>', '<i class="icon-heart"></i>', false);
                     }
                     $items .= '</div></div>';
                     if ($image) {
                         $items .= '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $item_title . '" />';
                     }
                     $items .= '</a>';
                 }
             }
             $items .= '</figure>';
             if ($show_title == "yes") {
                 $items .= '<h4 class="blog-item-title"><a href="' . $permalink . '">' . $item_title . '</a></h4>';
             }
             if ($show_details == "yes") {
                 $items .= '<div class="post-item-details">' . sprintf(__('By %1$s on %2$s', 'coope'), $post_author, $post_date) . '</div>';
             }
             if ($show_excerpt == "yes") {
                 $items .= '<div class="blog-item-excerpt">' . $post_excerpt . '</div>';
             }
             $items .= '</li>';
             $count++;
             $item_class = "";
         }
         wp_reset_query();
         $items .= '</ul>';
     }
     $el_class = $this->getExtraClass($el_class);
     $width = wpb_translateColumnWidthToSpan($width);
     $output .= "\n\t" . '<div class="wpb_posts_carousel_widget wpb_content_element ' . $width . $el_class . '">';
     $output .= "\n\t\t" . '<div class="wpb_wrapper carousel-wrap">';
     if ($title != '') {
         $output .= "\n\t\t\t" . '<div class="heading-wrap"><h3 class="wpb_heading">' . $title . '</h3><div class="carousel-nav"><a href="#" class="carousel-prev"><i class="icon-chevron-left"></i></a><a href="#" class="carousel-next"><i class="icon-chevron-right"></i></a></div></div>';
     } else {
         $output .= "\n\t\t\t" . '<div class="heading-wrap"><div class="carousel-nav"><a href="#" class="carousel-prev"><i class="icon-chevron-left"></i></a><a href="#" class="carousel-next"><i class="icon-chevron-right"></i></a></div></div>';
     }
     $output .= "\n\t\t\t\t" . $items;
     $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper');
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     global $include_carousel;
     $include_carousel = true;
     return $output;
 }
Beispiel #5
0
 protected function content($atts, $content = null)
 {
     $title = $width = $el_class = $output = $items = $item_figure = $el_position = '';
     extract(shortcode_atts(array('title' => '', "pagination" => "no", "blog_type" => "standard", "excerpt_length" => '20', "item_count" => '5', "category" => '', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
     // CATEGORY SLUG MODIFICATION
     if ($category == "All") {
         $category = "all";
     }
     if ($category == "all") {
         $category = '';
     }
     $category_slug = str_replace('_', '-', $category);
     // BLOG QUERY SETUP
     global $post, $wp_query;
     if (get_query_var('paged')) {
         $paged = get_query_var('paged');
     } elseif (get_query_var('page')) {
         $paged = get_query_var('page');
     } else {
         $paged = 1;
     }
     $blog_args = array('post_type' => 'post', 'post_status' => 'publish', 'paged' => $paged, 'category_name' => $category_slug, 'posts_per_page' => $item_count);
     $blog_items = new WP_Query($blog_args);
     $list_class = '';
     if ($blog_type == "masonry") {
         $list_class .= 'masonry-items';
     } else {
         if ($blog_type == "mini") {
             $list_class .= 'mini-items';
         } else {
             $list_class .= 'standard-items';
         }
     }
     $items .= '<ul class="blog-items ' . $list_class . ' clearfix">';
     while ($blog_items->have_posts()) {
         $blog_items->the_post();
         $post_format = get_post_format();
         $post_title = get_the_title();
         $post_author = get_the_author_link();
         $post_date = get_the_date();
         $post_categories = get_the_category_list(', ');
         $post_comments = get_comments_number();
         $post_permalink = get_permalink();
         $custom_excerpt = get_post_meta($post->ID, 'coope_custom_excerpt', true);
         $post_excerpt = '';
         if ($custom_excerpt != '') {
             $post_excerpt = custom_excerpt($custom_excerpt, $excerpt_length);
         } else {
             $post_excerpt = excerpt($excerpt_length);
         }
         $sidebar_config = get_post_meta($post->ID, 'coope_sidebar_config', true);
         $thumb_image = $thumb_width = $thumb_height = $bordered_thumb_width = $bordered_thumb_height = $video = $video_height = $bordered_video_height = $item_class = $link_config = $item_icon = '';
         if ($blog_type == "mini") {
             if ($sidebar_config == "no-sidebars") {
                 $thumb_width = 446;
                 $thumb_height = NULL;
                 $video_height = 250;
             } else {
                 $thumb_width = 290;
                 $thumb_height = NULL;
                 $video_height = 163;
             }
         } else {
             $thumb_width = 640;
             $thumb_height = NULL;
             $video_height = 360;
             $bordered_thumb_width = 408;
             $bordered_thumb_height = 303;
             $bordered_video_height = 303;
         }
         $thumb_type = get_post_meta($post->ID, 'coope_thumbnail_type', true);
         $thumb_image = rwmb_meta('coope_thumbnail_image', 'type=image&size=full');
         $thumb_video = get_post_meta($post->ID, 'coope_thumbnail_video_url', true);
         $thumb_gallery = rwmb_meta('coope_thumbnail_gallery', 'type=image&size=blog-image');
         $thumb_link_type = get_post_meta($post->ID, 'coope_thumbnail_link_type', true);
         $thumb_link_url = get_post_meta($post->ID, 'coope_thumbnail_link_url', true);
         $thumb_lightbox_thumb = rwmb_meta('coope_thumbnail_image', 'type=image&size=large');
         $thumb_lightbox_image = rwmb_meta('coope_thumbnail_link_image', 'type=image&size=large');
         $thumb_lightbox_video_url = get_post_meta($post->ID, 'coope_thumbnail_link_video_url', true);
         foreach ($thumb_image as $detail_image) {
             $thumb_img_url = $detail_image['url'];
             break;
         }
         if (!$thumb_image) {
             $thumb_image = get_post_thumbnail_id();
             $thumb_img_url = wp_get_attachment_url($thumb_image, 'full');
         }
         $thumb_lightbox_img_url = wp_get_attachment_url($thumb_lightbox_image, 'full');
         // LINK TYPE VARIABLES
         if ($thumb_link_type == "link_to_url") {
             $link_config = 'href="' . $thumb_link_url . '" class="link-to-url"';
             $item_icon = "link";
         } else {
             if ($thumb_link_type == "link_to_url_nw") {
                 $link_config = 'href="' . $thumb_link_url . '" class="link-to-url" target="_blank"';
                 $item_icon = "link";
             } else {
                 if ($thumb_link_type == "lightbox_thumb") {
                     $link_config = 'href="' . $thumb_img_url . '" class="view"';
                     $item_icon = "search";
                 } else {
                     if ($thumb_link_type == "lightbox_image") {
                         $lightbox_image_url = '';
                         foreach ($thumb_lightbox_image as $image) {
                             $lightbox_image_url = $image['full_url'];
                         }
                         $link_config = 'href="' . $lightbox_image_url . '" class="view"';
                         $item_icon = "search";
                     } else {
                         if ($thumb_link_type == "lightbox_video") {
                             $link_config = 'href="' . $thumb_lightbox_video_url . '" class="fancybox-media"';
                             $item_icon = "facetime-video";
                         } else {
                             $link_config = 'href="' . $post_permalink . '" class="link-to-post"';
                             $item_icon = "file";
                         }
                     }
                 }
             }
         }
         // THUMBNAIL MEDIA TYPE SETUP
         if ($thumb_type == "none") {
             $item_figure .= '<div class="spacer"></div>';
         } else {
             $item_figure .= '<figure>';
             if ($thumb_type == "video") {
                 $video = video_embed($thumb_video, $thumb_width, $video_height);
                 $item_figure .= $video;
             } else {
                 if ($thumb_type == "slider") {
                     $item_figure .= '<div class="flexslider thumb-slider"><ul class="slides">';
                     foreach ($thumb_gallery as $image) {
                         $item_figure .= "<li><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' /></li>";
                     }
                     $item_figure .= '</ul><div class="open-item"><a ' . $link_config . '><i class="icon-plus"></i></a></div></div>';
                 } else {
                     if ($thumb_type == "image") {
                         $image = aq_resize($thumb_img_url, $thumb_width, $thumb_height, true, false);
                         if ($image) {
                             $item_figure .= '<a ' . $link_config . '>';
                             if ($blog_type == "masonry") {
                                 $item_figure .= '<div class="overlay"><div class="thumb-info">';
                                 $item_figure .= '<i class="icon-' . $item_icon . '"></i>';
                                 $item_figure .= '</div></div>';
                             }
                             $item_figure .= '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" />';
                             $item_figure .= '</a>';
                         }
                     }
                 }
             }
             $item_figure .= '</figure>';
         }
         // BLOG ITEM OUTPUT
         $items .= '<li class="blog-item">';
         if ($blog_type == "masonry") {
             $items .= $item_figure;
             $item_figure = '';
             $items .= '<div class="blog-details-wrap">';
             $items .= '<h4><a href="' . $post_permalink . '">' . $post_title . '</a></h4>';
             $items .= '<div class="blog-item-details clearfix">' . sprintf(__('By <a href="%2$s">%1$s</a> on %3$s in %4$s', 'coope'), $post_author, get_author_posts_url(get_the_author_meta('ID')), $post_date, $post_categories) . '</div>';
             $items .= $item_figure;
             if ($post_format == "quote") {
                 $items .= '<div class="quote-excerpt heading-font">' . get_the_content() . '</div>';
             } else {
                 $items .= '<div class="excerpt">' . $post_excerpt . '</div>';
             }
             $items .= '<div class="read-more-bar"><a class="read-more" href="' . $post_permalink . '">' . __("Keep Reading", "coope") . '<i class="icon-chevron-right"></i></a>';
             $items .= '<div class="comments-likes">';
             if (comments_open()) {
                 $items .= '<a href="' . $post_permalink . '#comment-area"><i class="icon-comments"></i><span>' . $post_comments . '</span></a> ';
             }
             if (function_exists('lip_love_it_link')) {
                 $items .= lip_love_it_link(get_the_ID(), '<i class="icon-heart"></i>', '<i class="icon-heart"></i>', false);
             }
             $items .= '</div></div>';
         } else {
             $items .= '<div class="blog-details-wrap">';
             $items .= '<h2><a href="' . $post_permalink . '">' . $post_title . '</a></h2>';
             $items .= '<div class="blog-item-details clearfix">' . sprintf(__('By <a href="%2$s">%1$s</a> on %3$s in %4$s', 'coope'), $post_author, get_author_posts_url(get_the_author_meta('ID')), $post_date, $post_categories);
             $items .= '<div class="comments-likes">';
             if (comments_open()) {
                 $items .= '<a href="' . $post_permalink . '#comment-area"><i class="icon-comments"></i><span>' . $post_comments . '</span></a> ';
             }
             if (function_exists('lip_love_it_link')) {
                 $items .= lip_love_it_link(get_the_ID(), '<i class="icon-heart"></i>', '<i class="icon-heart"></i>', false);
             }
             $items .= '</div></div>';
             $items .= $item_figure;
             if ($post_format == "quote") {
                 $items .= '<div class="quote-excerpt heading-font">' . get_the_content() . '</div>';
             } else {
                 $items .= '<div class="excerpt">' . $post_excerpt . '</div>';
             }
             $items .= '<a class="read-more" href="' . $post_permalink . '">' . __("Keep Reading", "coope") . '<i class="icon-chevron-right"></i></a>';
         }
         $items .= '</div></li>';
         $item_figure = '';
     }
     wp_reset_postdata();
     $items .= '</ul>';
     // PAGINATION
     if ($pagination == "yes") {
         $items .= '<div class="pagination-wrap full-width">';
         $items .= pagenavi($blog_items);
         $items .= '</div>';
     }
     $el_class = $this->getExtraClass($el_class);
     $width = wpb_translateColumnWidthToSpan($width);
     $output .= "\n\t" . '<div class="wpb_blog_widget wpb_content_element ' . $width . $el_class . '">';
     $output .= "\n\t\t" . '<div class="wpb_wrapper blog-wrap">';
     $output .= $title != '' ? "\n\t\t\t" . '<div class="heading-wrap"><h3 class="wpb_heading">' . $title . '</h3></div>' : '';
     $output .= "\n\t\t\t\t" . $items;
     $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper');
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     if ($blog_type == "masonry") {
         global $include_isotope;
         $include_isotope = true;
     }
     global $has_blog;
     $has_blog = true;
     return $output;
 }
    $media_height = NULL;
    $video_height = 658;
    ?>
	
	<?php 
    if ($media_type != "none") {
        ?>
	
	<figure class="media-wrap">
			
	<?php 
        if ($media_type == "video") {
            ?>
		
		<?php 
            echo video_embed($media_video, $media_width, $video_height);
            ?>
		
	<?php 
        } else {
            if ($media_type == "slider") {
                ?>
		
		<div class="flexslider item-slider">
			
			<ul class="slides">
					
			<?php 
                foreach ($media_gallery as $image) {
                    echo "<li><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' /></li>";
                }
 protected function content($atts, $content = null)
 {
     $title = $category = $item_class = $width = $el_class = $output = $filter = $items = $el_position = '';
     extract(shortcode_atts(array('title' => '', "item_count" => '12', "category" => 'all', 'alt_background' => 'none', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
     // CATEGORY SLUG MODIFICATION
     if ($category == "All") {
         $category = "all";
     }
     if ($category == "all") {
         $category = '';
     }
     $category_slug = str_replace('_', '-', $category);
     global $post, $wp_query, $carouselID;
     if ($carouselID == "") {
         $carouselID = 1;
     } else {
         $carouselID++;
     }
     $portfolio_args = array('post_type' => 'portfolio', 'post_status' => 'publish', 'portfolio-category' => $category_slug, 'posts_per_page' => $item_count);
     $portfolio_items = new WP_Query($portfolio_args);
     $count = $columns = 0;
     $sidebar_config = get_post_meta(get_the_ID(), 'sf_sidebar_config', true);
     if ($sidebar_config == "left-sidebar" || $sidebar_config == "right-sidebar") {
         $item_class = 'span2';
     } else {
         if ($sidebar_config == "both-sidebars") {
             $item_class = 'span-bs-quarter';
         } else {
             $item_class = 'span3';
         }
     }
     if ($width == "1/4") {
         $columns = 1;
     } else {
         if ($width == "1/2") {
             $columns = 2;
         } else {
             if ($width == "3/4") {
                 $columns = 3;
             } else {
                 $columns = 4;
             }
         }
     }
     $items .= '<ul id="carousel-' . $carouselID . '" class="portfolio-items carousel-items clearfix" data-columns="' . $columns . '">';
     while ($portfolio_items->have_posts()) {
         $portfolio_items->the_post();
         $item_title = get_the_title();
         $thumb_type = get_post_meta($post->ID, 'sf_thumbnail_type', true);
         $thumb_image = rwmb_meta('sf_thumbnail_image', 'type=image&size=full');
         $thumb_video = get_post_meta($post->ID, 'sf_thumbnail_video_url', true);
         $thumb_gallery = rwmb_meta('sf_thumbnail_gallery', 'type=image&size=thumb-image');
         $thumb_link_type = get_post_meta($post->ID, 'sf_thumbnail_link_type', true);
         $thumb_link_url = get_post_meta($post->ID, 'sf_thumbnail_link_url', true);
         $thumb_lightbox_thumb = rwmb_meta('sf_thumbnail_image', 'type=image&size=large');
         $thumb_lightbox_image = rwmb_meta('sf_thumbnail_link_image', 'type=image&size=large');
         $thumb_lightbox_video_url = get_post_meta($post->ID, 'sf_thumbnail_link_video_url', true);
         foreach ($thumb_image as $detail_image) {
             $thumb_img_url = $detail_image['url'];
             break;
         }
         if (!$thumb_image) {
             $thumb_image = get_post_thumbnail_id();
             $thumb_img_url = wp_get_attachment_url($thumb_image, 'full');
         }
         $thumb_lightbox_img_url = wp_get_attachment_url($thumb_lightbox_image, 'full');
         $item_title = get_the_title();
         $permalink = get_permalink();
         if ($thumb_link_type == "link_to_url") {
             $link_config = 'href="' . $thumb_link_url . '" class="link-to-url"';
             $item_icon = "link";
         } else {
             if ($thumb_link_type == "link_to_url_nw") {
                 $link_config = 'href="' . $thumb_link_url . '" class="link-to-url" target="_blank"';
                 $item_icon = "link";
             } else {
                 if ($thumb_link_type == "lightbox_thumb") {
                     $link_config = 'href="' . $thumb_img_url . '" class="view"';
                     $item_icon = "search";
                 } else {
                     if ($thumb_link_type == "lightbox_image") {
                         $lightbox_image_url = '';
                         foreach ($thumb_lightbox_image as $image) {
                             $lightbox_image_url = $image['full_url'];
                         }
                         $link_config = 'href="' . $lightbox_image_url . '" class="view"';
                         $item_icon = "search";
                     } else {
                         if ($thumb_link_type == "lightbox_video") {
                             $link_config = 'href="' . $thumb_lightbox_video_url . '" rel="prettyPhoto"';
                             $item_icon = "facetime-video";
                         } else {
                             $link_config = 'href="' . $permalink . '" class="link-to-post"';
                             $item_icon = "chevron-right";
                         }
                     }
                 }
             }
         }
         $items .= '<li data-id="id-' . $count . '" class="clearfix carousel-item portfolio-item ' . $item_class . '">';
         $items .= '<figure>';
         // THUMBNAIL MEDIA TYPE SETUP
         if ($thumb_type == "video") {
             $video = video_embed($thumb_video, 420, 315);
             $items .= $video;
         } else {
             if ($thumb_type == "slider") {
                 $items .= '<div class="flexslider thumb-slider"><ul class="slides">';
                 foreach ($thumb_gallery as $image) {
                     $alt = $image['alt'];
                     if (!$alt) {
                         $alt = $image['title'];
                     }
                     $items .= "<li><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$alt}' /></li>";
                 }
                 $items .= '</ul><div class="open-item"><a ' . $link_config . '><i class="icon-plus"></i></a></div></div>';
             } else {
                 $image = aq_resize($thumb_img_url, 420, 315, true, false);
                 if ($image) {
                     $items .= '<a ' . $link_config . '>';
                     $items .= '<div class="overlay"><div class="thumb-info">';
                     $items .= '<i class="icon-' . $item_icon . '"></i>';
                     $items .= '</div></div>';
                     $items .= '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $item_title . '" />';
                     $items .= '</a>';
                 }
             }
         }
         $items .= '</figure>';
         $items .= '<div class="item-details clearfix">';
         $items .= '<h4 class="portfolio-item-title"><a ' . $link_config . '"><span>' . $item_title . '</span><i class="icon-angle-right"></i></a></h4>';
         $items .= '</div>';
         $items .= '</li>';
         $count++;
     }
     wp_reset_query();
     $items .= '</ul>';
     $items .= '<a href="#" class="prev"><i class="icon-chevron-left"></i></a><a href="#" class="next"><i class="icon-chevron-right"></i></a>';
     $width = wpb_translateColumnWidthToSpan($width);
     $el_class = $this->getExtraClass($el_class);
     if ($alt_background == "none" || $sidebar_config != "no-sidebars" || $width != "span12") {
         $output .= "\n\t" . '<div class="wpb_portfolio_carousel_widget wpb_content_element ' . $width . $el_class . '">';
     } else {
         $output .= "\n\t" . '<div class="wpb_portfolio_carousel_widget wpb_content_element alt-bg ' . $alt_background . ' ' . $width . $el_class . '">';
     }
     $output .= "\n\t\t" . '<div class="wpb_wrapper carousel-wrap">';
     if ($title != '') {
         $output .= "\n\t\t\t" . '<div class="heading-wrap"><h3 class="wpb_heading">' . $title . '</h3></div>';
     } else {
         $output .= "\n\t\t\t" . '<div class="heading-wrap"></div>';
     }
     $output .= "\n\t\t\t\t" . $items;
     $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper');
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     global $include_carousel, $include_isotope;
     $include_carousel = true;
     $include_isotope = true;
     return $output;
 }
Beispiel #8
0
 protected function content($atts, $content = null)
 {
     $title = $width = $el_class = $filter_output = $output = $tax_terms = $items = $el_position = '';
     extract(shortcode_atts(array('title' => '', 'display_type' => 'standard', 'columns' => '4', 'show_title' => 'yes', 'show_subtitle' => 'yes', 'show_excerpt' => 'no', "excerpt_length" => '20', 'item_count' => '-1', 'category' => '', 'portfolio_filter' => 'yes', 'pagination' => 'no', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
     $sidebar_config = get_post_meta(get_the_ID(), 'sf_sidebar_config', true);
     $sidebars = '';
     if ($sidebar_config == "left-sidebar" || $sidebar_config == "right-sidebar") {
         $sidebars = 'one-sidebar';
     } else {
         if ($sidebar_config == "both-sidebars") {
             $sidebars = 'both-sidebars';
         } else {
             $sidebars = 'no-sidebars';
         }
     }
     $options = get_option('sf_flexform_options');
     $filter_wrap_bg = $options['filter_wrap_bg'];
     if ($portfolio_filter == "yes" && $sidebars == "no-sidebars") {
         $tax_terms = "";
         if ($category == "" || $category == "All") {
             $tax_terms = $tax_terms = get_category_list('portfolio-category', 1, "");
         } else {
             $tax_terms = $tax_terms = get_category_list('portfolio-category', 1, $category);
         }
         $filter_output .= '<div class="filter-wrap row clearfix">' . "\n";
         $filter_output .= '<a href="#" class="select"><i class="icon-align-justify"></i>' . __("Filter our work", "swiftframework") . '</a>' . "\n";
         $filter_output .= '<div class="filter-slide-wrap span12 alt-bg ' . $filter_wrap_bg . '">' . "\n";
         $filter_output .= '<ul class="portfolio-filter filtering row clearfix">' . "\n";
         $filter_output .= '<li class="all selected span2"><a data-filter="*" href="#"><span class="item-name">' . __("All", "swiftframework") . '</span><span class="item-count">0</span></a></li>' . "\n";
         foreach ($tax_terms as $tax_term) {
             $term_slug = strtolower(str_replace(' ', '-', $tax_term));
             $filter_output .= '<li class="span2"><a href="#" title="View all ' . $tax_term . ' items" class="' . $term_slug . '" data-filter=".' . $term_slug . '"><span class="item-name">' . $tax_term . '</span><span class="item-count">0</span></a></li>' . "\n";
         }
         $filter_output .= '</ul></div></div>' . "\n";
     }
     // CATEGORY SLUG MODIFICATION
     if ($category == "All") {
         $category = "all";
     }
     if ($category == "all") {
         $category = '';
     }
     $category_slug = str_replace('_', '-', $category);
     // PORTFOLIO QUERY SETUP
     global $post, $wp_query;
     if (get_query_var('paged')) {
         $paged = get_query_var('paged');
     } elseif (get_query_var('page')) {
         $paged = get_query_var('page');
     } else {
         $paged = 1;
     }
     $portfolio_args = array('post_type' => 'portfolio', 'post_status' => 'publish', 'paged' => $paged, 'portfolio-category' => $category_slug, 'posts_per_page' => $item_count);
     $portfolio_items = new WP_Query($portfolio_args);
     $count = 0;
     if ($columns == "1") {
         $items .= '<ul class="portfolio-items ' . $display_type . '-portfolio single-column filterable-items row clearfix">' . "\n";
     } else {
         $items .= '<ul class="portfolio-items ' . $display_type . '-portfolio filterable-items row clearfix">' . "\n";
     }
     // PORTFOLIO LOOP
     while ($portfolio_items->have_posts()) {
         $portfolio_items->the_post();
         // META VARIABLES
         $thumb_image = $thumb_gallery = $video = $item_class = $link_config = '';
         $thumb_width = 420;
         $thumb_height = 315;
         $video_height = 315;
         $thumb_type = get_post_meta($post->ID, 'sf_thumbnail_type', true);
         $thumb_image = rwmb_meta('sf_thumbnail_image', 'type=image&size=full');
         $thumb_video = get_post_meta($post->ID, 'sf_thumbnail_video_url', true);
         if ($columns == "1") {
             $thumb_gallery = rwmb_meta('sf_thumbnail_gallery', 'type=image&size=thumb-image-onecol');
         } else {
             if ($columns == "2") {
                 $thumb_gallery = rwmb_meta('sf_thumbnail_gallery', 'type=image&size=thumb-image-twocol');
             } else {
                 $thumb_gallery = rwmb_meta('sf_thumbnail_gallery', 'type=image&size=thumb-image');
             }
         }
         $thumb_link_type = get_post_meta($post->ID, 'sf_thumbnail_link_type', true);
         $thumb_link_url = get_post_meta($post->ID, 'sf_thumbnail_link_url', true);
         $thumb_lightbox_thumb = rwmb_meta('sf_thumbnail_image', 'type=image&size=large');
         $thumb_lightbox_image = rwmb_meta('sf_thumbnail_link_image', 'type=image&size=large');
         $thumb_lightbox_video_url = get_post_meta($post->ID, 'sf_thumbnail_link_video_url', true);
         foreach ($thumb_image as $detail_image) {
             $thumb_img_url = $detail_image['url'];
             break;
         }
         if (!$thumb_image) {
             $thumb_image = get_post_thumbnail_id();
             $thumb_img_url = wp_get_attachment_url($thumb_image, 'full');
         }
         $thumb_lightbox_img_url = wp_get_attachment_url($thumb_lightbox_image, 'full');
         $item_title = get_the_title();
         $item_subtitle = get_post_meta($post->ID, 'sf_portfolio_subtitle', true);
         $permalink = get_permalink();
         $custom_excerpt = get_post_meta($post->ID, 'sf_custom_excerpt', true);
         $post_excerpt = '';
         if ($custom_excerpt != '') {
             $post_excerpt = custom_excerpt($custom_excerpt, $excerpt_length);
         } else {
             $post_excerpt = excerpt($excerpt_length);
         }
         $post_terms = get_the_terms($post->ID, 'portfolio-category');
         $term_slug = " ";
         if (!empty($post_terms)) {
             foreach ($post_terms as $post_term) {
                 $term_slug = $term_slug . strtolower(str_replace(' ', '-', $post_term->name)) . ' ';
             }
         }
         // COLUMN OPTION VARIABLES
         $item_class = $item_icon = "";
         if ($columns == "1") {
             if ($sidebars == "both-sidebars") {
                 $item_class = "span6 ";
             } else {
                 if ($sidebars == "one-sidebar") {
                     $item_class = "span8 ";
                 } else {
                     $item_class = "span10 offset1 ";
                 }
             }
             $excerpt = get_the_excerpt();
             $thumb_width = 970;
             $thumb_height = NULL;
             $video_height = 545;
         } else {
             if ($columns == "2") {
                 if ($sidebars == "both-sidebars") {
                     $item_class = "span3 ";
                 } else {
                     if ($sidebars == "one-sidebar") {
                         $item_class = "span4 ";
                     } else {
                         $item_class = "span6 ";
                         $thumb_width = 600;
                         $thumb_height = 450;
                         $video_height = 450;
                     }
                 }
             } else {
                 if ($columns == "3") {
                     if ($sidebars == "both-sidebars") {
                         $item_class = "span2 ";
                     } else {
                         if ($sidebars == "one-sidebar") {
                             $item_class = "span-third ";
                         } else {
                             $item_class = "span4 ";
                         }
                     }
                 } else {
                     if ($columns == "4") {
                         if ($sidebars == "both-sidebars") {
                             $item_class = "span3 ";
                         } else {
                             if ($sidebars == "one-sidebar") {
                                 $item_class = "span2 ";
                             } else {
                                 $item_class = "span3 ";
                             }
                         }
                     }
                 }
             }
         }
         // DISPLAY TYPE VARIABLES
         if ($display_type == "standard") {
             $item_class .= "standard ";
         } else {
             if ($display_type == "gallery") {
                 $item_class .= "gallery ";
             }
         }
         // LINK TYPE VARIABLES
         if ($thumb_link_type == "link_to_url") {
             $link_config = 'href="' . $thumb_link_url . '" class="link-to-url"';
             $item_icon = "link";
         } else {
             if ($thumb_link_type == "link_to_url_nw") {
                 $link_config = 'href="' . $thumb_link_url . '" class="link-to-url" target="_blank"';
                 $item_icon = "link";
             } else {
                 if ($thumb_link_type == "lightbox_thumb") {
                     $link_config = 'href="' . $thumb_img_url . '" class="view"';
                     $item_icon = "search";
                 } else {
                     if ($thumb_link_type == "lightbox_image") {
                         $lightbox_image_url = '';
                         foreach ($thumb_lightbox_image as $image) {
                             $lightbox_image_url = $image['full_url'];
                         }
                         $link_config = 'href="' . $lightbox_image_url . '" class="view"';
                         $item_icon = "search";
                     } else {
                         if ($thumb_link_type == "lightbox_video") {
                             $link_config = 'href="' . $thumb_lightbox_video_url . '" rel="prettyPhoto"';
                             $item_icon = "facetime-video";
                         } else {
                             $link_config = 'href="' . $permalink . '" class="link-to-post"';
                             $item_icon = "chevron-right";
                         }
                     }
                 }
             }
         }
         $items .= '<li data-id="id-' . $count . '" class="clearfix portfolio-item ' . $item_class . ' ' . $term_slug . '">' . "\n";
         if ($thumb_type != "none") {
             $items .= '<figure>' . "\n";
             // THUMBNAIL MEDIA TYPE SETUP
             if ($thumb_type == "video") {
                 $video = video_embed($thumb_video, $thumb_width, $video_height);
                 $items .= $video;
             } else {
                 if ($thumb_type == "slider") {
                     $items .= '<div class="flexslider thumb-slider"><ul class="slides">' . "\n";
                     foreach ($thumb_gallery as $image) {
                         $items .= "<li><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' /></li>" . "\n";
                     }
                     $items .= '</ul><div class="open-item"><a ' . $link_config . '><i class="icon-plus"></i></a></div></div>' . "\n";
                 } else {
                     $image = aq_resize($thumb_img_url, $thumb_width, $thumb_height, true, false);
                     if ($image) {
                         $items .= '<a ' . $link_config . '>' . "\n";
                         if ($columns != "1") {
                             $items .= '<div class="overlay"><div class="thumb-info">' . "\n";
                             if ($display_type == "standard") {
                                 $items .= '<i class="icon-' . $item_icon . '"></i>' . "\n";
                             } else {
                                 $items .= '<h4>' . $item_title . '</h4>' . "\n";
                                 $items .= '<i class="icon-' . $item_icon . ' small-icon"></i>' . "\n";
                             }
                             $items .= '</div></div>' . "\n";
                         }
                         $items .= '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $item_title . '" />' . "\n";
                         $items .= '</a>' . "\n";
                     }
                 }
             }
             $items .= '</figure>' . "\n";
         }
         // MASONRY ITEM
         if ($display_type == "standard") {
             $items .= '<div class="portfolio-item-details">' . "\n";
             if ($show_title == "yes") {
                 if ($columns == "1") {
                     $items .= '<h1 class="portfolio-item-title"><a ' . $link_config . '>' . $item_title . '</a></h1>' . "\n";
                 } else {
                     $items .= '<h4 class="portfolio-item-title"><a ' . $link_config . '>' . $item_title . '</a></h4>' . "\n";
                 }
             }
             if ($show_subtitle == "yes" && $item_subtitle) {
                 if ($columns == "1") {
                     $items .= '<h3 class="portfolio-subtitle">' . $item_subtitle . '</h3>' . "\n";
                 } else {
                     $items .= '<h5 class="portfolio-subtitle">' . $item_subtitle . '</h5>' . "\n";
                 }
             }
             if ($show_excerpt == "yes") {
                 $items .= '<div class="portfolio-item-excerpt">' . $post_excerpt . '</div>' . "\n";
             }
             $items .= '</div>' . "\n";
         }
         $items .= '</li>' . "\n";
         $count++;
     }
     wp_reset_postdata();
     $items .= '</ul>' . "\n";
     // PAGINATION
     if ($pagination == "yes") {
         $items .= '<div class="pagination-wrap">' . "\n";
         $items .= pagenavi($portfolio_items);
         $items .= '</div>' . "\n";
     }
     // PAGE BUILDER OUPUT
     $width = wpb_translateColumnWidthToSpan($width);
     $el_class = $this->getExtraClass($el_class);
     $output .= "\n\t" . '<div class="wpb_portfolio_widget wpb_content_element ' . $width . $el_class . '">';
     $output .= "\n\t\t" . '<div class="wpb_wrapper portfolio-wrap">';
     $output .= $title != '' ? "\n\t\t\t" . '<div class="heading-wrap"><h3 class="wpb_heading">' . $title . '</h3></div>' : '';
     if ($portfolio_filter == "yes") {
         $output .= "\n\t\t\t" . $filter_output;
     }
     $output .= "\n\t\t\t\t" . $items;
     $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper');
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     global $include_isotope;
     global $has_portfolio;
     $include_isotope = true;
     $has_portfolio = true;
     return $output;
 }
Beispiel #9
0
 protected function content($atts, $content = null)
 {
     $options = get_option('sf_flexform_options');
     $title = $width = $excerpt_length = $el_class = $output = $items = $el_position = '';
     extract(shortcode_atts(array('title' => '', "item_count" => '4', "category" => '', "excerpt_length" => '20', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
     // CATEGORY SLUG MODIFICATION
     if ($category == "All") {
         $category = "all";
     }
     if ($category == "all") {
         $category = '';
     }
     $category_slug = str_replace('_', '-', $category);
     global $post, $wp_query;
     $sidebar_config = get_post_meta(get_the_ID(), 'sf_sidebar_config', true);
     if ($sidebar_config == "left-sidebar" || $sidebar_config == "right-sidebar") {
         $item_class = 'span2';
     } else {
         if ($sidebar_config == "both-sidebars") {
             $item_class = 'span-bs-quarter';
         } else {
             $item_class = 'span3';
         }
     }
     $args = array('post_type' => 'post', 'post_status' => 'publish', 'category_name' => $category_slug, 'posts_per_page' => $item_count);
     $blog_items = query_posts($args);
     if (have_posts()) {
         $items .= '<ul class="recent-posts row clearfix">';
         while (have_posts()) {
             the_post();
             $thumb_type = get_post_meta($post->ID, 'sf_thumbnail_type', true);
             $thumb_image = rwmb_meta('sf_thumbnail_image', 'type=image&size=full');
             $thumb_video = get_post_meta($post->ID, 'sf_thumbnail_video_url', true);
             $thumb_gallery = rwmb_meta('sf_thumbnail_gallery', 'type=image&size=thumb-image');
             foreach ($thumb_image as $detail_image) {
                 $thumb_img_url = $detail_image['url'];
                 break;
             }
             if (!$thumb_image) {
                 $thumb_image = get_post_thumbnail_id();
                 $thumb_img_url = wp_get_attachment_url($thumb_image, 'full');
             }
             $item_title = get_the_title();
             $post_author = get_the_author_link();
             $post_date = get_the_date();
             $post_permalink = get_permalink();
             $post_comments = get_comments_number();
             $custom_excerpt = get_post_meta($post->ID, 'sf_custom_excerpt', true);
             $post_excerpt = '';
             if ($custom_excerpt != '') {
                 $post_excerpt = custom_excerpt($custom_excerpt, $excerpt_length);
             } else {
                 $post_excerpt = excerpt($excerpt_length);
             }
             $thumb_link_type = get_post_meta($post->ID, 'sf_thumbnail_link_type', true);
             $thumb_link_url = get_post_meta($post->ID, 'sf_thumbnail_link_url', true);
             $thumb_lightbox_thumb = rwmb_meta('sf_thumbnail_image', 'type=image&size=large');
             $thumb_lightbox_image = rwmb_meta('sf_thumbnail_link_image', 'type=image&size=large');
             $thumb_lightbox_video_url = get_post_meta($post->ID, 'sf_thumbnail_link_video_url', true);
             $thumb_lightbox_img_url = wp_get_attachment_url($thumb_lightbox_image, 'full');
             if ($thumb_link_type == "link_to_url") {
                 $link_config = 'href="' . $thumb_link_url . '" class="link-to-url"';
                 $item_icon = "link";
             } else {
                 if ($thumb_link_type == "link_to_url_nw") {
                     $link_config = 'href="' . $thumb_link_url . '" class="link-to-url" target="_blank"';
                     $item_icon = "link";
                 } else {
                     if ($thumb_link_type == "lightbox_thumb") {
                         $link_config = 'href="' . $thumb_img_url . '" class="view"';
                         $item_icon = "search";
                     } else {
                         if ($thumb_link_type == "lightbox_image") {
                             $lightbox_image_url = '';
                             foreach ($thumb_lightbox_image as $image) {
                                 $lightbox_image_url = $image['full_url'];
                             }
                             $link_config = 'href="' . $lightbox_image_url . '" class="view"';
                             $item_icon = "search";
                         } else {
                             if ($thumb_link_type == "lightbox_video") {
                                 $link_config = 'href="' . $thumb_lightbox_video_url . '" rel="prettyPhoto"';
                                 $item_icon = "facetime-video";
                             } else {
                                 $link_config = 'href="' . $post_permalink . '" class="link-to-post"';
                                 $item_icon = "file-alt";
                             }
                         }
                     }
                 }
             }
             $items .= '<li class="recent-post ' . $item_class . ' clearfix">';
             $items .= '<figure>';
             if ($thumb_type == "video") {
                 $video = video_embed($thumb_video, 270, 202);
                 $items .= $video;
             } else {
                 if ($thumb_type == "slider") {
                     $items .= '<div class="flexslider thumb-slider"><ul class="slides">';
                     foreach ($thumb_gallery as $image) {
                         $alt = $image['alt'];
                         if (!$alt) {
                             $alt = $image['title'];
                         }
                         $items .= "<li><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$alt}' /></li>";
                     }
                     $items .= '</ul><div class="open-item"><a ' . $link_config . '><i class="icon-plus"></i></a></div></div>';
                 } else {
                     $image = aq_resize($thumb_img_url, 420, 315, true, false);
                     $items .= '<a ' . $link_config . '>';
                     $items .= '<div class="overlay"><div class="thumb-info">';
                     $items .= '<i class="icon-' . $item_icon . '"></i>';
                     $items .= '</div></div>';
                     if ($image) {
                         $items .= '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $item_title . '" />';
                     }
                     $items .= '</a>';
                 }
             }
             $items .= '</figure>';
             $items .= '<div class="details-wrap">';
             $items .= '<h4><a href="' . $post_permalink . '">' . $item_title . '</a></h4>';
             if ($excerpt_length != "0") {
                 $items .= '<div class="excerpt">' . $post_excerpt . '</div>';
             }
             $items .= '</div>';
             $items .= '<div class="post-item-details clearfix">';
             $items .= '<span class="post-date">' . $post_date . '</span>';
             $items .= '<div class="comments-likes">';
             if (comments_open()) {
                 $items .= '<a href="' . $post_permalink . '#comment-area"><i class="icon-comments"></i><span>' . $post_comments . '</span></a> ';
             }
             if (function_exists('lip_love_it_link')) {
                 $items .= lip_love_it_link(get_the_ID(), '<i class="icon-heart"></i>', '<i class="icon-heart"></i>', false);
             }
             $items .= '</div>';
             $items .= '</div>';
             $items .= '</li>';
         }
         wp_reset_query();
         $items .= '</ul>';
     }
     $el_class = $this->getExtraClass($el_class);
     $width = wpb_translateColumnWidthToSpan($width);
     $output .= "\n\t" . '<div class="wpb_recent_posts_widget wpb_content_element ' . $width . $el_class . '">';
     $output .= "\n\t\t" . '<div class="wpb_wrapper recent-posts-wrap">';
     $output .= $title != '' ? "\n\t\t\t" . '<div class="heading-wrap"><h3 class="wpb_heading"><span>' . $title . '</span></h3></div>' : '';
     $output .= "\n\t\t\t\t" . $items;
     $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper');
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     return $output;
 }