?>
 <?php 
        echo $grid;
        ?>
"> 
                                            
                <div class="ut-portfolio-item">                    
                            
                        <?php 
        #-----------------------------------------------------------------
        # embedded video or image
        #-----------------------------------------------------------------
        $url = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
        $image = lambda_resize($url, 1156, 584, true, true, true);
        if ($portfoliotype == 'video' && !empty($portfoliometa['portfolio_video_embedded_code'])) {
            $url = lambda_extract_url($portfoliometa['portfolio_video_embedded_code']);
        }
        ?>
                        
                        <div class="view view-fifth">
                            
                            <i class="ut-portfolio-icon <?php 
        echo $portfolioicon;
        ?>
"></i>
                            
                            <img alt="<?php 
        echo $title;
        ?>
" src="<?php 
        echo $image;
    function lambda_portfolio_columns($portfolio, $containerID = 'none', $pagebuilder = false)
    {
        /* retrieve settings first */
        $theme_options = get_option('option_tree');
        $container = $containerID != 'none' ? 'id="' . $containerID . '"' : '';
        if (!$pagebuilder) {
            $portfolio['portfolio_item_title'] = !empty($portfolio['portfolio_item_title_home']) ? $portfolio['portfolio_item_title_home'] : 'off';
        }
        ?>
                          
			<?php 
        if (!empty($portfolio['portfolio_headline'])) {
            ?>
				
                
                <?php 
            $textalign = !empty($portfolio['portfolio_textalign']) ? $portfolio['portfolio_textalign'] : 'center';
            ?>
                                
                <div class="span12 clearfix" style="text-align:<?php 
            echo $textalign;
            ?>
;">
                 
                    <header class="ut-title-header clearfix">
                    
                        <?php 
            if (!empty($portfolio['portfolio_headline'])) {
                ?>
                        
                            <h1 class="ut-title"><span><?php 
                echo lambda_translate_meta($portfolio['portfolio_headline']);
                ?>
</span></h1>
                            
                        <?php 
            }
            ?>
                        
                        <?php 
            if (!empty($portfolio['portfolio_subheadline'])) {
                ?>
                        
                            <h2 class="ut-sub-title"><?php 
                echo lambda_translate_meta($portfolio['portfolio_subheadline']);
                ?>
</h2>
                            
                        <?php 
            }
            ?>
                        
                    </header>
                    
                    <?php 
            if (!empty($portfolio['portfolio_content'])) {
                ?>
                    
                        <p><?php 
                echo do_shortcode(lambda_translate_meta($portfolio['portfolio_content']));
                ?>
</p>
                    
                    <?php 
            }
            ?>
                    
                    <?php 
            if (!empty($portfolio['portfolio_link'])) {
                ?>
    
                        <span style="position:relative; z-index:1;"><a class="ut-btn theme-btn small" href="<?php 
                echo $portfolio['portfolio_link'];
                ?>
"><?php 
                echo $portfolio['portfolio_link_text'];
                ?>
</a></span>
                        
                    <?php 
            }
            ?>
                
                </div>
                                
            <?php 
        }
        ?>
                  	      
                        
			<?php 
        #-----------------------------------------------------------------
        # custom project types for portfolio query
        #-----------------------------------------------------------------
        $project_types = '';
        $preview = '';
        $unkown = '';
        if (isset($portfolio['project_type'])) {
            if (is_array($portfolio['project_type'])) {
                $project_types = "&project-type=";
                foreach ($portfolio['project_type'] as $type) {
                    $project_types .= $type . ',';
                }
                $project_types = substr($project_types, 0, -1);
            }
        }
        $posts_per_page = isset($portfolio['portfolio_count']) ? $portfolio['portfolio_count'] : '3';
        $portfoliogrid = isset($portfolio['portfolio_grid']) ? $portfolio['portfolio_grid'] : 'span3';
        $gridcount = array('span4' => '3', 'span3' => '4', 'span6' => '2');
        /* start query */
        query_posts('post_type=' . UT_PORTFOLIO_SLUG . '&posts_per_page=' . $posts_per_page . '&project_types=' . $project_types);
        #-----------------------------------------------------------------
        # get all taxonomys project types
        #-----------------------------------------------------------------
        $taxonomys = get_terms('project-type');
        if (is_array(get_option('wpalchemy_taxonomy_project-type'))) {
            $taxSort = array_sort(get_option('wpalchemy_taxonomy_project-type'), 'SortID', SORT_ASC);
            if (is_array($taxonomys)) {
                /* run trough taxonomy array */
                foreach ($taxonomys as $taxkey => $taxval) {
                    /* run trough sorting array */
                    foreach ($taxSort as $sortkey => $sortval) {
                        if ($taxval->term_id == $sortkey) {
                            $taxonomys[$taxkey]->SortID = $sortval['SortID'];
                        }
                    }
                }
            }
        }
        uasort($taxonomys, "compareItems");
        #-----------------------------------------------------------------
        # get all used taxonomy project types
        #-----------------------------------------------------------------
        $used_taxonomys = array();
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                global $post;
                if (is_array(wp_get_object_terms($post->ID, 'project-type'))) {
                    foreach (wp_get_object_terms($post->ID, 'project-type') as $term) {
                        $used_taxonomys[$term->term_id] = $term->name;
                    }
                }
            }
        }
        ?>
	
            
            
            
            <?php 
        #-----------------------------------------------------------------
        # Isotope Effect
        #-----------------------------------------------------------------
        ?>
 
            <script type="text/javascript">
            jQuery(document).ready(function($){
                
                $container = $('#ut-portfolio-items-<?php 
        echo $containerID;
        ?>
');
                    
                $container.imagesLoaded( function(){
                    
                    /* IsoTope
                    ================================================== */									
                    $container.isotope({
                      animationEngine : 'best-available',
                      layoutMode:'fitRows',
                      resizable: false,
                      masonry: { columnWidth: $container.width() / <?php 
        echo $gridcount[$portfoliogrid];
        ?>
 }
                      
                    });
                    
                    var $sortedItems = $container.data('isotope').$filteredAtoms;
                        
                    $('#ut-portfolio-menu-<?php 
        echo $containerID;
        ?>
 a').click(function(){
                      var selector = $(this).attr('data-filter');
                      $container.isotope({ filter: selector });
                      
                      if ( !$(this).hasClass('selected') ) {
                            $(this).parents('#ut-portfolio-menu-<?php 
        echo $containerID;
        ?>
').find('.selected').removeClass('selected');
                            $(this).addClass('selected');
                      }		  
                      
                      $container.isotope( 'reLayout');	
                      return false;
                    });		
                });
                
                $(window).smartresize(function(){
                   
                    $container.isotope({
                        // update columnWidth to a percentage of container width
                        masonry: { columnWidth: $container.width() / <?php 
        echo $gridcount[$portfoliogrid];
        ?>
 }
                    });
                            
                });
                    
            });
            </script>
            
            <?php 
        if (isset($portfolio['activate_portfolio_filter_menu']) && $portfolio['activate_portfolio_filter_menu'] == 'on') {
            ?>
            
            <!--start portfolio menu-->
            <div class="<?php 
            echo !$pagebuilder ? 'span12' : '';
            ?>
 remove-bottom">
                <ul id="ut-portfolio-menu-<?php 
            echo $containerID;
            ?>
" class="ut-portfolio-menu">
                
                        <?php 
            #-----------------------------------------------------------------
            # create final sorted portfolio filter
            #-----------------------------------------------------------------
            $portfolio_filter = array();
            if (is_array($taxonomys)) {
                $tax = 1;
                foreach ($taxonomys as $key => $value) {
                    if ($taxonomys[$key]->parent == 0 && isset($taxonomys[$key]->name) && in_array($taxonomys[$key]->name, $used_taxonomys)) {
                        echo '<li><a href="#" data-filter="*" class="selected">' . $taxonomys[$key]->name . '</a></li>';
                    }
                    if (in_array($taxonomys[$key]->name, $used_taxonomys) && $taxonomys[$key]->parent != 0) {
                        echo '<li><a href="#" data-filter=".' . $taxonomys[$key]->slug . '_filt">' . $taxonomys[$key]->name . '</a></li>';
                    }
                    $tax++;
                }
            }
            ?>
                                        
                </ul>
            </div>
            <!--end portfolio menu-->					
            
            <?php 
        }
        ?>
            
            <?php 
        echo !$pagebuilder ? '<div class="span12 remove-bottom">' : '';
        ?>
            
            <div id="ut-portfolio-items-<?php 
        echo $containerID;
        ?>
" <?php 
        echo !$pagebuilder ? 'class="row"' : '';
        ?>
>
            <?php 
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                #-----------------------------------------------------------------
                # Portfolio Meta Data & IconSet
                #-----------------------------------------------------------------
                $portfoliometa = lambda_return_meta('page', get_the_ID());
                $portfoliotype = '';
                if (isset($portfoliometa['portfolio_type'])) {
                    switch ($portfoliometa['portfolio_type']) {
                        case 'video_portfolio':
                            $portfoliotype = 'video';
                            $portfolioicon = 'icon-film';
                            break;
                        case 'audio_portfolio':
                            $portfoliotype = 'audio';
                            $portfolioicon = 'icon-headphones';
                            break;
                        case 'single_image_portfolio':
                            $portfoliotype = 'image';
                            $portfolioicon = 'icon-camera-retro';
                            break;
                        case 'image_portfolio':
                            $portfoliotype = 'gallery';
                            $portfolioicon = 'icon-picture';
                            break;
                        case NULL:
                            $portfoliotype = 'standard';
                            $portfolioicon = 'icon-camera-retro';
                            break;
                    }
                }
                $title = str_ireplace('"', '', trim(get_the_title()));
                #-----------------------------------------------------------------
                # get all project-types for this item
                #-----------------------------------------------------------------
                $projecttype = NULL;
                $projecttypeclean = NULL;
                $preview = '';
                $unkown = '';
                $singletaxonomy = array();
                $project_cats = wp_get_object_terms($post->ID, 'project-type');
                if (is_array($project_cats)) {
                    foreach ($project_cats as $types) {
                        $projecttype .= $types->slug . "_filt ";
                        /* run trough sorting array */
                        if (isset($taxSort) && is_array($taxSort)) {
                            foreach ($taxSort as $sortkey => $sortval) {
                                if ($types->term_id == $sortkey && $types->parent > 0) {
                                    $singletaxonomy[$types->term_id]->SortID = $sortval['SortID'];
                                    $singletaxonomy[$types->term_id]->name = $types->name;
                                }
                            }
                        }
                    }
                }
                /* cut last whitespace and comma */
                uasort($singletaxonomy, "compareItems");
                foreach ($singletaxonomy as $singleprojecttype) {
                    $projecttypeclean .= $singleprojecttype->name . ', ';
                }
                $projecttypeclean = substr($projecttypeclean, 0, -2);
                ?>
	
                    
                    <div class="<?php 
                echo $projecttype;
                ?>
 <?php 
                echo $portfoliogrid;
                ?>
">
                        
                        <div class="ut-portfolio-item">
                        
                        <?php 
                #-----------------------------------------------------------------
                # embedded video or image
                #-----------------------------------------------------------------
                $url = wp_get_attachment_url(get_post_thumbnail_id());
                $image = lambda_resize($url, 1156, 584, true, true, true);
                if ($portfoliotype == 'video' && isset($portfoliometa['portfolio_video_embedded_code'])) {
                    $url = lambda_extract_url($portfoliometa['portfolio_video_embedded_code']) . '?width=800';
                }
                ?>
    
                        
                        <div class="view view-fifth">
                            <i class="ut-portfolio-icon <?php 
                echo $portfolioicon;
                ?>
"></i>
                            <img alt="<?php 
                echo $title;
                ?>
" src="<?php 
                echo $image;
                ?>
" />
                            <div class="mask">
                                <div class="mask-inner clearfix">
                                
                                    <div class="hi-icon-wrap hi-icon-effect-1 hi-icon-effect-1a link">
                                        <a href="<?php 
                the_permalink();
                ?>
" class="hi-icon icon-share-alt"></a>
                                    </div>
                                    
                                    <div class="hi-icon-wrap hi-icon-effect-1 hi-icon-effect-1a">
                                        <a href="<?php 
                echo $url;
                ?>
" class="hi-icon icon-fullscreen" data-rel="prettyPhoto[<?php 
                echo $post->ID;
                ?>
]"></a>
                                    </div>
                                
                                </div><!-- inner-mask -->
                            </div><!-- mask -->    
                        </div><!-- view view-fifth -->                                                   
                        
                        
                        <?php 
                if ($portfoliotype == 'gallery') {
                    ?>
                    
                            <div style="display:none;">
                                
                                <?php 
                    $ut_gallery_images = lambda_extract_gallery_images_ids();
                    ?>
                                
                                <?php 
                    if (isset($ut_gallery_images) && is_array($ut_gallery_images)) {
                        ?>
                                    
                                    <?php 
                        foreach ($ut_gallery_images as $ID => $imagedata) {
                            ?>
                                        
                                         <?php 
                            if (isset($imagedata->guid) && !empty($imagedata->guid)) {
                                $image = $imagedata->guid;
                                // fallback to older wp versions
                            } else {
                                $image = wp_get_attachment_image_src($imagedata, 'single-post-thumbnail');
                                $image = $image[0];
                            }
                            ?>
                                        
                                        <a href="<?php 
                            echo $image;
                            ?>
" data-rel="prettyPhoto[<?php 
                            echo $post->ID;
                            ?>
]"></a>
                                        
                                  <?php 
                        }
                        ?>
       
                                
                                <?php 
                    }
                    ?>
 
                                
                            </div>
                            
                        <?php 
                }
                ?>
                        
                            
                        <?php 
                #-----------------------------------------------------------------
                # display title or not
                #-----------------------------------------------------------------
                if (isset($portfolio['portfolio_item_title']) && $portfolio['portfolio_item_title'] == 'on') {
                    ?>
							
                            
                        <a href="<?php 
                    the_permalink();
                    ?>
">						
                            <h1>
                                <?php 
                    echo $title;
                    ?>
                                <span><?php 
                    echo $projecttypeclean;
                    ?>
</span>                                        
                            </h1>
                        </a>                               
                            
                            
                        <?php 
                }
                // endif
                ?>
    
                        
                        </div>
                    </div>    
                    
            	<?php 
            }
        }
        ?>
                    
                </div>
                
				<?php 
        echo !$pagebuilder ? '</div>' : '';
        ?>
                    
		<?php 
        wp_reset_query();
    }