Exemplo n.º 1
0
 function ut_get_portfolio_post_content()
 {
     global $post;
     /* get portfolio id */
     $portfolio_id = (int) $_POST['portfolio_id'];
     $the_content = NULL;
     /* get post object */
     $post = get_post($portfolio_id, OBJECT);
     setup_postdata($post);
     /* get post format */
     $post_format = get_post_format($portfolio_id);
     /* try to catch video url */
     $video_url = ut_get_portfolio_format_video_content(get_the_content());
     /* modify content ( fallback to old version ) */
     if ($post_format == 'video') {
         $the_content = str_replace($video_url, "", get_the_content());
         $the_content = apply_filters('the_content', $the_content);
     } elseif ($post_format == 'gallery') {
         $the_content = preg_replace('/(.?)\\[(gallery)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/\\2\\])?(.?)/s', '$1$6', get_the_content());
         $the_content = apply_filters('the_content', $the_content);
     } else {
         $the_content = apply_filters('the_content', get_the_content());
     }
     $post_content = '<h2 class="ut-portfolio-title">' . get_the_title($portfolio_id) . '</h2>';
     $post_content .= $the_content;
     wp_reset_postdata($post);
     echo $post_content;
     die(1);
 }
Exemplo n.º 2
0
 function ut_get_portfolio_post()
 {
     /* needed variable */
     $content = $video_url = NULL;
     /* get portfolio id */
     $portfolio_id = (int) $_POST['portfolio_id'];
     /* get post object */
     $portfolio = get_post($portfolio_id, OBJECT);
     /* get post format */
     $post_format = get_post_format($portfolio_id);
     /* hero type setting - new with 2.6 */
     $ut_page_hero_type = get_post_meta($portfolio_id, 'ut_page_hero_type', true);
     $ut_page_video_source = get_post_meta($portfolio_id, 'ut_page_video_source', true);
     if (!empty($ut_page_hero_type) && $ut_page_hero_type == 'video') {
         /* youtube video */
         if (isset($ut_page_video_source) && $ut_page_video_source == 'youtube') {
             $content = get_post_meta($portfolio_id, 'ut_page_video', true);
             /* try to catch video url */
             $video_url = ut_get_portfolio_format_video_content($content);
         }
         /* selfhosted video */
         if (isset($ut_page_video_source) && $ut_page_video_source == 'selfhosted') {
             $mp4 = $ogg = $webm = NULL;
             $mp4 = get_post_meta($portfolio_id, 'ut_page_video_mp4', true);
             $ogg = get_post_meta($portfolio_id, 'ut_page_video_ogg', true);
             $webm = get_post_meta($portfolio_id, 'ut_page_video_webm', true);
             if (!empty($mp4) || !empty($ogg) || !empty($webm)) {
                 $mp4 = !empty($mp4) ? 'mp4="' . $mp4 . '"' : '';
                 $ogg = !empty($ogg) ? 'ogv="' . $ogg . '"' : '';
                 $webm = !empty($webm) ? 'mov="' . $webm . '"' : '';
                 /* built wordpress shortcode */
                 $content = '[video ' . $mp4 . ' ' . $ogg . ' ' . $webm . ']';
             }
         }
         /* custom video */
         if (isset($ut_page_video_source) && $ut_page_video_source == 'custom') {
             $content = get_post_meta($portfolio_id, 'ut_page_video_custom', true);
             /* try to catch video url */
             $video_url = ut_get_portfolio_format_video_content($content);
         }
         /* content is still empty - let's assign the regular content */
         if (empty($content)) {
             $content = $portfolio->post_content;
             /* try to catch video url */
             $video_url = ut_get_portfolio_format_video_content($content);
         }
     } else {
         $content = $portfolio->post_content;
         /* try to catch video url */
         $video_url = ut_get_portfolio_format_video_content($content);
     }
     /* get embed code */
     if (!empty($video_url)) {
         $embed_code = wp_oembed_get($video_url);
     } else {
         /*no video URL found, maybe we can display the embedded code? */
         if (isset($ut_page_video_source) && $ut_page_video_source == 'custom') {
             $embed_code = get_post_meta($portfolio_id, 'ut_page_video_custom', true);
         } elseif (isset($ut_page_video_source) && $ut_page_video_source == 'selfhosted') {
             $embed_code = $content;
         } else {
             /* set empty value */
             $embed_code = '';
         }
     }
     /* add high quality */
     if (strpos($embed_code, 'youtu.be') !== false || strpos($embed_code, 'youtube.com') !== false) {
         $embed_code = preg_replace("@src=(['\"])?([^'\">\\s]*)@", "src=\$1\$2&vq=hd720", $embed_code);
     }
     echo do_shortcode($embed_code);
     die(1);
 }
Exemplo n.º 3
0
    <?php 
if (have_posts()) {
    ?>
                
        <?php 
    while (have_posts()) {
        the_post();
        /* assign content - depending on the post format we might need to modify it */
        $content = get_the_content();
        /* standard post format or audio format */
        if (empty($post_format) || $post_format == 'audio') {
            $the_content = apply_filters('the_content', $content);
            /* video post format */
        } elseif ($post_format == 'video') {
            /* try to catch video url */
            $video_url = ut_get_portfolio_format_video_content($content);
            if (!empty($video_url)) {
                /* cut out the video url from content and format it */
                $the_content = str_replace($video_url, "", $content);
                $the_content = apply_filters('the_content', $the_content);
            }
            /* gallery post format */
        } elseif ($post_format == 'gallery') {
            /* assign content */
            $content = preg_replace('/(.?)\\[(gallery)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/\\2\\])?(.?)/s', '$1$6', $content);
            $the_content = apply_filters('the_content', $content);
        }
        ?>
    
            
            <div class="grid-container">
 static function create_portfolio_gallery()
 {
     global $paged, $wp_query;
     /* pagination */
     if (empty($paged)) {
         if (!empty($_GET['paged'])) {
             $paged = $_GET['paged'];
         } elseif (!empty($wp->matched_query) && ($args = wp_parse_args($wp->matched_query))) {
             if (!empty($args['paged'])) {
                 $paged = $args['paged'];
             }
         }
         if (!empty($paged)) {
             $wp_query->set('paged', $paged);
         }
     }
     $temp = $wp_query;
     $wp_query = $term = null;
     /* settings */
     $portfolio_categories = get_post_meta(self::$token, 'ut_portfolio_categories');
     $term = '';
     /* global portfolio settings */
     $portfolio_settings = get_post_meta(self::$token, 'ut_portfolio_settings');
     $portfolio_settings = $portfolio_settings[0];
     /* gallery options */
     $gallery_options = get_post_meta(self::$token, 'ut_gallery_options');
     $gallery_options = $gallery_options[0];
     /* detail style */
     $detailstyle = !empty($portfolio_settings['detail_style']) ? $portfolio_settings['detail_style'] : 'slideup';
     /* columnset */
     $columnset = !empty($gallery_options['columns']) ? $gallery_options['columns'] : 4;
     $gutter = !empty($gallery_options['gutter']) ? 'gutter' : '';
     /* image style */
     $image_style_class = $portfolio_settings['image_style'];
     /* variables for last row item */
     switch ($columnset) {
         case 2:
             $z = 0;
             $counter = 1;
             break;
         case 3:
             $z = 4;
             $counter = 2;
             break;
         case 4:
             $z = 5;
             $counter = 3;
             break;
     }
     /* fallback if no meta has been set */
     $portfolio_per_page = !empty($portfolio_settings['posts_per_page']) ? $portfolio_settings['posts_per_page'] : 4;
     $portfolio_categories = !empty($portfolio_categories) ? $portfolio_categories : array();
     /* portfolio query terms */
     $portfolio_terms = array();
     if (is_array($portfolio_categories[0]) && !empty($portfolio_categories[0])) {
         foreach ($portfolio_categories[0] as $key => $value) {
             array_push($portfolio_terms, $key);
         }
         $portfolio_terms_query = $portfolio_terms;
     }
     /* only change term if browser is browsing this portfolio */
     if (!empty($_GET['portfolioID']) && $_GET['portfolioID'] == self::$token) {
         if ($gallery_options['filter_type'] == 'static' && !empty($_GET['termID'])) {
             /* sanitize term */
             $term = absint($_GET['termID']);
             /* reset terms */
             $portfolio_terms_query = array();
             array_push($portfolio_terms_query, $term);
         }
     }
     /* user is not browsing this portfolio , so we reset the pagination */
     if (!empty($_GET['portfolioID']) && $_GET['portfolioID'] != self::$token) {
         $paged = 0;
     }
     /* query args */
     $portfolio_args = array('post_type' => 'portfolio', 'posts_per_page' => $portfolio_per_page, 'paged' => $paged, 'tax_query' => array(array('taxonomy' => 'portfolio-category', 'terms' => $portfolio_terms_query, 'field' => 'term_id')));
     /* start query */
     $portfolio_query = $wp_query = new WP_Query($portfolio_args);
     /* portfolio filter */
     if (!empty($gallery_options['filter'])) {
         $filter = '<div class="ut-portfolio-menu-wrap"><ul id="ut-portfolio-menu-' . self::$token . '" class="ut-portfolio-menu ' . (!empty($gallery_options['filter_style']) ? $gallery_options['filter_style'] : 'style_one') . '">';
         /* reset button */
         $reset = !empty($gallery_options['reset_text']) ? $gallery_options['reset_text'] : __('All', 'ut_portfolio_lang');
         if ($gallery_options['filter_type'] == 'static') {
             $selected = empty($term) ? 'class="selected"' : '';
             $filter .= '<li><a href="?portfolioID=' . self::$token . '#ut-portfolio-items-' . self::$token . '-anchor" data-filter="*" ' . $selected . '>' . $reset . '</a></li>';
         } else {
             $filter .= '<li><a href="#" data-filter="*" class="selected">' . $reset . '</a></li>';
         }
         /* get taxonomies */
         $taxonomies = get_terms('portfolio-category');
         $taxonomiesarray = json_decode(json_encode($taxonomies), true);
         if (is_array($portfolio_terms) && is_array($taxonomies)) {
             foreach ($portfolio_terms as $single_term) {
                 $key = self::search_tax_key($single_term, $taxonomiesarray);
                 if ($gallery_options['filter_type'] == 'static' && isset($key)) {
                     $selected = $taxonomies[$key]->term_id == $term ? 'class="selected"' : '';
                     $filter .= '<li><a ' . $selected . ' href="?termID=' . $taxonomies[$key]->term_id . '&amp;portfolioID=' . self::$token . '#ut-portfolio-items-' . self::$token . '-anchor" data-filter=".' . $taxonomies[$key]->slug . '-filt">' . $taxonomies[$key]->name . '</a></li>';
                 } else {
                     if (isset($taxonomies[$key]->slug)) {
                         $filter .= '<li><a href="#" data-filter=".' . $taxonomies[$key]->slug . '-filt">' . $taxonomies[$key]->name . '</a></li>';
                     }
                 }
             }
         }
         $filter .= '</ul></div>';
     }
     /* needed javascript */
     $gallery = self::generate_gallery_script($gallery_options, $counter);
     /* create hidden gallery */
     if ($detailstyle == 'slideup') {
         $gallery .= self::create_hidden_popup_portfolio($portfolio_args, $portfolio_settings['image_style']);
     }
     /* output portfolio wrap */
     $gallery .= '<div id="ut-portfolio-wrap" class="ut-portfolio-wrap" data-textcolor="' . $portfolio_settings["text_color"] . '" data-opacity="' . $portfolio_settings["hover_opacity"] . '" data-hovercolor="' . ut_hex_to_rgb($portfolio_settings["hover_color"]) . '">';
     $gallery .= '<a class="ut-portfolio-offset-anchor" style="top:-120px;" id="ut-portfolio-items-' . self::$token . '-anchor"></a>';
     /* add filter */
     if (isset($gallery_options['filter'])) {
         $gallery .= $filter;
     }
     /* output portfolio container */
     $gallery .= '<div id="ut-portfolio-items-' . self::$token . '" class="ut-portfolio-item-container">';
     /* loop trough portfolio items */
     if ($portfolio_query->have_posts()) {
         while ($portfolio_query->have_posts()) {
             $portfolio_query->the_post();
             /* needed variables */
             $projecttype = '';
             $title = str_ireplace('"', '', trim(get_the_title()));
             $post_format = get_post_format();
             /* link settings */
             $ut_portfolio_link_type = get_post_meta($portfolio_query->post->ID, 'ut_portfolio_link_type', true);
             $external = false;
             $target = '_blank';
             /* theme meta boxes are storing strings */
             if (!is_array($ut_portfolio_link_type)) {
                 $temp_array = array();
                 $temp_array['target'] = $ut_portfolio_link_type;
                 $ut_portfolio_link_type = $temp_array;
                 $temp_array = null;
             }
             if (!empty($ut_portfolio_link_type['target']) && $ut_portfolio_link_type['target'] == 'external') {
                 /* get link user haas to set */
                 $external = get_post_meta($portfolio_query->post->ID, 'ut_external_link', true);
             } elseif (!empty($ut_portfolio_link_type['target']) && $ut_portfolio_link_type['target'] == 'internal') {
                 /* get permalink to single portfolio */
                 $external = get_permalink($portfolio_query->post->ID);
                 $target = '_self';
             }
             /* itemposition */
             $itemposition = '';
             if ($columnset != 3) {
                 if ($columnset == 2) {
                     $z % 2 == 0 ? $itemposition = '' : ($itemposition = 'last');
                 }
                 if ($columnset == 4) {
                     $z % 4 == 0 ? $itemposition = 'last' : ($itemposition = '');
                 }
             } else {
                 if ($z % 3 == 0) {
                     $itemposition = 'last';
                     $z = 3;
                 }
             }
             /* get all portfolio-categories for this item ( needed for filter ) */
             $portfolio_cats = wp_get_object_terms($portfolio_query->post->ID, 'portfolio-category');
             /* set filter attributes */
             if (is_array($portfolio_cats)) {
                 foreach ($portfolio_cats as $single_cat) {
                     $projecttype .= $single_cat->slug . "-filt ";
                 }
             }
             /* gallery style */
             $gallery_style = !empty($gallery_options['style']) ? $gallery_options['style'] : 'style_one';
             /* portfolio featured image */
             $fullsize = $thumbnail = $portfolio_detail_image = wp_get_attachment_url(get_post_thumbnail_id($portfolio_query->post->ID));
             $caption = get_post(get_post_thumbnail_id($portfolio_query->post->ID))->post_excerpt;
             /* hero type setting - new with 2.6 */
             $ut_page_hero_type = get_post_meta($portfolio_query->post->ID, 'ut_page_hero_type', true);
             $optionkey = 'ut_page_hero_image';
             if (!empty($ut_page_hero_type)) {
                 if ($ut_page_hero_type == 'image' || $ut_page_hero_type == 'animatedimage' || $ut_page_hero_type == 'splithero' || $ut_page_hero_type == 'custom' || $ut_page_hero_type == 'dynamic') {
                     $post_format = '';
                 }
                 if ($ut_page_hero_type == 'slider' || $ut_page_hero_type == 'transition' || $ut_page_hero_type == 'tabs') {
                     $post_format = 'gallery';
                 }
                 if ($ut_page_hero_type == 'video') {
                     $post_format = 'video';
                     $ut_page_video_source = get_post_meta($portfolio_query->post->ID, 'ut_page_video_source', true);
                 }
                 /* switch option key */
                 switch ($ut_page_hero_type) {
                     case 'animatedimage':
                         $optionkey = 'ut_page_hero_animated_image';
                         break;
                     default:
                         $optionkey = 'ut_page_hero_image';
                 }
             }
             /* end ut_page_hero_type */
             /* check if there is a detail image available */
             $portfolio_detail_image_data = get_post_meta($portfolio_query->post->ID, $optionkey, true);
             if (is_array($portfolio_detail_image_data) && !empty($portfolio_detail_image_data['background-image'])) {
                 $portfolio_detail_image = $portfolio_detail_image_data['background-image'];
             } elseif (!is_array($portfolio_detail_image_data) && !empty($portfolio_detail_image_data)) {
                 $portfolio_detail_image = $portfolio_detail_image_data;
             }
             /* cropping dimensions */
             $width = !empty($gallery_options['crop_size_x']) ? $gallery_options['crop_size_x'] : '600';
             $height = !empty($gallery_options['crop_size_y']) ? $gallery_options['crop_size_y'] : '400';
             $thumbnail = ut_resize($fullsize, $width, $height, true, true, true);
             /* style one images with title */
             if ($gallery_style == 'style_one') {
                 /* create single portfolio item */
                 $gallery .= '<article class="' . $projecttype . ' ' . $itemposition . ' ut-masonry ' . $gutter . ' portfolio-style-one">';
                 $gallery .= '<div class="ut-portfolio-item ut-hover">';
                 /* link markup for slideup details */
                 if ($detailstyle == 'slideup') {
                     /* has external link */
                     if (!empty($external)) {
                         $gallery .= '<a class="' . $image_style_class . '" rel="bookmark" title="' . $title . '" href="' . $external . '" target="' . $target . '">';
                     } else {
                         $gallery .= '<a class="ut-portfolio-link ' . $image_style_class . '" rel="bookmark" title="' . $title . '" data-wrap="' . self::$token . '" data-post="' . $portfolio_query->post->ID . '" href="#ut-portfolio-details-wrap-' . self::$token . '">';
                     }
                 }
                 /* link markup for image popup */
                 if ($detailstyle == 'popup') {
                     $popuplink = NULL;
                     /* image post or audio post */
                     if (empty($post_format) || $post_format == 'audio') {
                         /* has external link */
                         if (!empty($external)) {
                             $gallery .= '<a class="' . $image_style_class . '" rel="bookmark" title="' . $title . '" href="' . $external . '" target="' . $target . '">';
                         } else {
                             if (self::$lightbox == 'ut-lightgallery') {
                                 $gallery .= '<div class="ut-new-hide" id="ut-lightgallery-sub-html-' . $portfolio_query->post->ID . '"><h4>' . $title . '</h4><p>' . $caption . '</p></div>';
                             }
                             $gallery .= '<a data-rel="' . self::$lightbox . '" class="' . $portfolio_settings['image_style'] . '" data-sub-html="#ut-lightgallery-sub-html-' . $portfolio_query->post->ID . '" title="' . $caption . '" href="' . $portfolio_detail_image . '">';
                         }
                     }
                     /* video post */
                     if ($post_format == 'video') {
                         /* has external link */
                         if (!empty($external)) {
                             $gallery .= '<a class="' . $image_style_class . '" rel="bookmark" title="' . $title . '" href="' . $external . '" target="' . $target . '">';
                         } else {
                             /* get the content */
                             if (!empty($ut_page_hero_type) && $ut_page_hero_type == 'video') {
                                 /* youtube video */
                                 if (isset($ut_page_video_source) && $ut_page_video_source == 'youtube') {
                                     $content = get_post_meta($portfolio_query->post->ID, 'ut_page_video', true);
                                 }
                                 /* selfhosted video - not supported by prettyphoto */
                                 if (isset($ut_page_video_source) && $ut_page_video_source == 'selfhosted') {
                                     $popuplink = $fullsize;
                                 }
                                 /* custom video */
                                 if (isset($ut_page_video_source) && $ut_page_video_source == 'custom') {
                                     $content = get_post_meta($portfolio_query->post->ID, 'ut_page_video_custom', true);
                                 }
                                 /* content is still empty - let's assign the regular content */
                                 if (empty($content)) {
                                     $content = get_the_content();
                                 }
                             } else {
                                 $content = get_the_content();
                             }
                             /* try to catch video url */
                             $popuplink = !empty($popuplink) ? $popuplink : ut_get_portfolio_format_video_content($content);
                             if (self::$lightbox == 'ut-lightgallery') {
                                 $gallery .= '<div class="ut-new-hide" id="ut-lightgallery-sub-html-' . $portfolio_query->post->ID . '"><h4>' . $title . '</h4><p>' . $caption . '</p></div>';
                             }
                             $gallery .= '<a data-rel="' . self::$lightbox . '" class="' . $portfolio_settings['image_style'] . '" data-sub-html="#ut-lightgallery-sub-html-' . $portfolio_query->post->ID . '" title="' . $caption . '" href="' . $popuplink . '">';
                         }
                     }
                     /* gallery post */
                     if ($post_format == 'gallery') {
                         /* has external link */
                         if (!empty($external)) {
                             $gallery .= '<a class="' . $image_style_class . '" rel="bookmark" title="' . $title . '" href="' . $external . '" target="' . $target . '">';
                         } else {
                             if (self::$lightbox == 'ut-lightgallery') {
                                 $gallery .= ut_portfolio_lightgallery($portfolio_query->post->ID, self::$token, $ut_page_hero_type);
                             } else {
                                 $gallery .= ut_portfolio_prettyphoto_gallery($portfolio_query->post->ID, self::$token, $ut_page_hero_type);
                             }
                             $gallery .= '<a class="ut-portfolio-popup-' . $portfolio_query->post->ID . ' ' . $portfolio_settings['image_style'] . '" title="' . $caption . '" href="' . $portfolio_detail_image . '">';
                         }
                     }
                 }
                 if (has_post_thumbnail() && !post_password_required()) {
                     $gallery .= '<figure><img alt="' . get_the_title() . '" width="' . $width . '" height="' . $height . '" src="' . UT_PORTFOLIO_URL . 'i/?w=' . $width . '&amp;h=' . $height . self::$cache . '" class="portfolio-lazy"  data-original="' . $thumbnail . '" /></figure>';
                 } elseif (post_password_required()) {
                     $gallery .= '<div class="ut-password-protected">' . __('Password Protected Portfolio', 'ut_portfolio_lang') . '</div>';
                 }
                 $gallery .= '<div class="ut-hover-layer">';
                 $gallery .= '<div class="ut-portfolio-info">';
                 $gallery .= '<div class="ut-portfolio-info-c">';
                 /* item title */
                 $gallery .= '<h2 class="portfolio-title">' . $title . '</h2>';
                 $gallery .= '<span>' . ut_generate_cat_list($portfolio_cats) . '</span>';
                 $gallery .= '</div>';
                 $gallery .= '</div>';
                 $gallery .= '</div>';
                 $gallery .= '</a>';
                 $gallery .= '</div>';
                 $gallery .= '</article>';
             }
             /* style two only images and title beneath */
             if ($gallery_style == 'style_two') {
                 /* create single portfolio item */
                 $gallery .= '<article class="' . $projecttype . ' ' . $itemposition . ' ut-masonry ' . $gutter . ' portfolio-style-two">';
                 $gallery .= '<div class="ut-portfolio-item ut-hover">';
                 /* link markup for slideup details */
                 if ($detailstyle == 'slideup') {
                     /* has external link */
                     if ($external) {
                         $gallery .= '<a class="' . $image_style_class . '" rel="bookmark" title="' . $title . '" href="' . $external . '" target="' . $target . '">';
                     } else {
                         $gallery .= '<a class="ut-portfolio-link ' . $image_style_class . '" rel="bookmark" title="' . $title . '" data-wrap="' . self::$token . '" data-post="' . $portfolio_query->post->ID . '" href="#ut-portfolio-details-wrap-' . self::$token . '">';
                     }
                 }
                 /* link markup for image popup */
                 if ($detailstyle == 'popup') {
                     $popuplink = NULL;
                     /* image post or audio post */
                     if (empty($post_format) || $post_format == 'audio') {
                         /* has external link */
                         if ($external) {
                             $gallery .= '<a class="' . $image_style_class . '" rel="bookmark" title="' . $title . '" href="' . $external . '" target="' . $target . '">';
                         } else {
                             if (self::$lightbox == 'ut-lightgallery') {
                                 $gallery .= '<div class="ut-new-hide" id="ut-lightgallery-sub-html-' . $portfolio_query->post->ID . '"><h4>' . $title . '</h4><p>' . $caption . '</p></div>';
                             }
                             $gallery .= '<a data-rel="' . self::$lightbox . '" class="' . $portfolio_settings['image_style'] . '" data-sub-html="#ut-lightgallery-sub-html-' . $portfolio_query->post->ID . '" title="' . $caption . '" href="' . $portfolio_detail_image . '">';
                         }
                     }
                     /* video post */
                     if ($post_format == 'video') {
                         /* has external link */
                         if (!empty($external)) {
                             $gallery .= '<a class="' . $image_style_class . '" rel="bookmark" title="' . $title . '" href="' . $external . '" target="' . $target . '">';
                         } else {
                             /* get the content */
                             if (!empty($ut_page_hero_type) && $ut_page_hero_type == 'video') {
                                 /* youtube video */
                                 if (isset($ut_page_video_source) && $ut_page_video_source == 'youtube') {
                                     $content = get_post_meta($portfolio_query->post->ID, 'ut_page_video', true);
                                 }
                                 /* selfhosted video - not supported by prettyphoto */
                                 if (isset($ut_page_video_source) && $ut_page_video_source == 'selfhosted') {
                                     $popuplink = $fullsize;
                                 }
                                 /* custom video */
                                 if (isset($ut_page_video_source) && $ut_page_video_source == 'custom') {
                                     $content = get_post_meta($portfolio_query->post->ID, 'ut_page_video_custom', true);
                                 }
                                 /* content is still empty - let's assign the regular content */
                                 if (empty($content)) {
                                     $content = get_the_content();
                                 }
                             } else {
                                 $content = get_the_content();
                             }
                             /* try to catch video url */
                             $popuplink = !empty($popuplink) ? $popuplink : ut_get_portfolio_format_video_content($content);
                             if (self::$lightbox == 'ut-lightgallery') {
                                 $gallery .= '<div class="ut-new-hide" id="ut-lightgallery-sub-html-' . $portfolio_query->post->ID . '"><h4>' . $title . '</h4><p>' . $caption . '</p></div>';
                             }
                             $gallery .= '<a data-rel="' . self::$lightbox . '" class="' . $portfolio_settings['image_style'] . '" data-sub-html="#ut-lightgallery-sub-html-' . $portfolio_query->post->ID . '" title="' . $caption . '" href="' . $popuplink . '">';
                         }
                     }
                     /* gallery post */
                     if ($post_format == 'gallery') {
                         /* has external link */
                         if ($external) {
                             $gallery .= '<a class="' . $image_style_class . '" rel="bookmark" title="' . $title . '" href="' . $external . '" target="' . $target . '">';
                         } else {
                             if (self::$lightbox == 'ut-lightgallery') {
                                 $gallery .= ut_portfolio_lightgallery($portfolio_query->post->ID, self::$token, $ut_page_hero_type);
                             } else {
                                 $gallery .= ut_portfolio_prettyphoto_gallery($portfolio_query->post->ID, self::$token, $ut_page_hero_type);
                             }
                             $gallery .= '<a class="ut-portfolio-popup-' . $portfolio_query->post->ID . ' ' . $portfolio_settings['image_style'] . '" title="' . $title . '" href="#">';
                         }
                     }
                 }
                 if (has_post_thumbnail() && !post_password_required()) {
                     $gallery .= '<figure><img alt="' . get_the_title() . '" width="' . $width . '" height="' . $height . '" src="' . UT_PORTFOLIO_URL . 'i/?w=' . $width . '&amp;h=' . $height . self::$cache . '" class="portfolio-lazy"  data-original="' . $thumbnail . '" /></figure>';
                 } elseif (post_password_required()) {
                     $gallery .= '<div class="ut-password-protected">' . __('Password Protected Portfolio', 'ut_portfolio_lang') . '</div>';
                 }
                 $gallery .= '<div class="ut-hover-layer">';
                 $gallery .= '<div class="ut-portfolio-info">';
                 $gallery .= '<div class="ut-portfolio-info-c">';
                 if ($post_format == 'video') {
                     $gallery .= '<i class="fa fa-film fa-lg"></i>';
                 }
                 if ($post_format == 'audio') {
                     $gallery .= '<i class="fa fa-headphones fa-lg"></i>';
                 }
                 if ($post_format == 'gallery') {
                     $gallery .= '<i class="fa fa-camera-retro fa-lg"></i>';
                 }
                 if (empty($post_format)) {
                     $gallery .= '<i class="fa fa-picture-o fa-lg"></i>';
                 }
                 $gallery .= '<span>' . ut_generate_cat_list($portfolio_cats) . '</span>';
                 $gallery .= '</div>';
                 $gallery .= '</div>';
                 $gallery .= '</div>';
                 $gallery .= '</a>';
                 $gallery .= '<div>';
                 /* link markup for slideup details */
                 if ($detailstyle == 'slideup') {
                     $gallery .= '<a class="ut-portfolio-link ' . $portfolio_settings['image_style'] . '" rel="bookmark" title="' . $title . '" data-wrap="' . self::$token . '" data-post="' . $portfolio_query->post->ID . '" href="#ut-portfolio-details-wrap-' . self::$token . '">';
                 }
                 /* link markup for image popup */
                 if ($detailstyle == 'popup') {
                     $popuplink = NULL;
                     /* image post or audio post */
                     if (empty($post_format) || $post_format == 'audio') {
                         /* has external link */
                         if ($external) {
                             $gallery .= '<a class="' . $image_style_class . '" rel="bookmark" title="' . $caption . '" href="' . $external . '" target="' . $target . '">';
                         } else {
                             $gallery .= '<a data-rel="' . self::$lightbox . '" class="' . $image_style_class . '" data-sub-html="#ut-lightgallery-sub-html-' . $portfolio_query->post->ID . '" title="' . $caption . '" href="' . $portfolio_detail_image . '">';
                         }
                     }
                     /* video post */
                     if ($post_format == 'video') {
                         /* has external link */
                         if ($external) {
                             $gallery .= '<a class="' . $image_style_class . '" rel="bookmark" title="' . $caption . '" href="' . $external . '" target="' . $target . '">';
                         } else {
                             /* get the content */
                             if (!empty($ut_page_hero_type) && $ut_page_hero_type == 'video') {
                                 /* youtube video */
                                 if (isset($ut_page_video_source) && $ut_page_video_source == 'youtube') {
                                     $content = get_post_meta($portfolio_query->post->ID, 'ut_page_video', true);
                                 }
                                 /* selfhosted video - not supported by prettyphoto */
                                 if (isset($ut_page_video_source) && $ut_page_video_source == 'selfhosted') {
                                     $popuplink = $fullsize;
                                 }
                                 /* custom video */
                                 if (isset($ut_page_video_source) && $ut_page_video_source == 'custom') {
                                     $content = get_post_meta($portfolio_query->post->ID, 'ut_page_video_custom', true);
                                 }
                                 /* content is still empty - let's assign the regular content */
                                 if (empty($content)) {
                                     $content = get_the_content();
                                 }
                             } else {
                                 $content = get_the_content();
                             }
                             /* try to catch video url */
                             $popuplink = !empty($popuplink) ? $popuplink : ut_get_portfolio_format_video_content($content);
                             $gallery .= '<a data-rel="' . self::$lightbox . '" class="' . $portfolio_settings['image_style'] . '" data-sub-html="#ut-lightgallery-sub-html-' . $portfolio_query->post->ID . '" title="' . $caption . '" href="' . $popuplink . '">';
                         }
                     }
                     /* gallery post */
                     if ($post_format == 'gallery') {
                         /* has external link */
                         if ($external) {
                             $gallery .= '<a class="' . $image_style_class . '" rel="bookmark" title="' . $caption . '" href="' . $external . '" target="' . $target . '">';
                         } else {
                             $gallery .= '<a class="ut-portfolio-popup-' . $portfolio_query->post->ID . ' ' . $portfolio_settings['image_style'] . '" title="' . $title . '" href="#">';
                         }
                     }
                 }
                 /* item title */
                 $gallery .= '<h2 class="portfolio-title">' . $title . '</h2>';
                 $gallery .= '</a>';
                 $gallery .= '</div>';
                 $gallery .= '</div>';
                 $gallery .= '</article>';
             }
             $z++;
         }
     }
     /* end portfolio container */
     $gallery .= '</div>';
     /* portfolio pagination */
     if ($portfolio_query->max_num_pages > 1) {
         $gallery .= '<nav class="ut-portfolio-pagination clearfix ' . (!empty($gallery_options['filter_style']) ? $gallery_options['filter_style'] : 'style_one') . '">';
         if ($paged > 1) {
             $gallery .= '<a href="?paged=' . ($paged - 1) . '&amp;portfolioID=' . self::$token . '&amp;termID=' . $term . '#ut-portfolio-items-' . self::$token . '-anchor"><i class="fa fa-angle-double-left"></i></a>';
         }
         for ($i = 1; $i <= $portfolio_query->max_num_pages; $i++) {
             $selected = $paged == $i || empty($paged) && $i == 1 ? 'selected' : '';
             $gallery .= '<a href="?paged=' . $i . '&amp;portfolioID=' . self::$token . '&amp;termID=' . $term . '#ut-portfolio-items-' . self::$token . '-anchor" class="' . $selected . '">' . $i . '</a>';
         }
         if ($paged < $portfolio_query->max_num_pages) {
             $paged_next = $paged == 0 ? $paged + 1 : $paged;
             $gallery .= '<a href="?paged=' . ($paged_next + 1) . '&amp;portfolioID=' . self::$token . '&amp;termID=' . $term . '#ut-portfolio-items-' . self::$token . '-anchor"><i class="fa fa-angle-double-right"></i></a>';
         }
         $gallery .= '</nav>';
     }
     /* end portfolio wrap */
     $gallery .= '</div>';
     /* restore wp_query */
     $wp_query = null;
     $wp_query = $temp;
     /* reset query */
     wp_reset_postdata();
     /* return final gallery */
     return $gallery;
 }