<div class="single-portfolio-gallery fix">
				
				<?php 
        $width = 864;
        $args = 'width=' . $width;
        $embed = woo_embed($args);
        if ($embed != '') {
            echo $embed;
        } else {
            $args .= '&return=true&link=img&noheight=true';
            $html = '';
            $rel = 'lightbox';
            // Get the other images.
            $images = woo_get_post_images(0, 'full');
            if (count($images) > 0) {
                $rel = 'lightbox[' . $post->ID . ']';
            }
            // Store featured image ID for exclusion
            if (isset($woo_options['woo_post_image_support']) && $woo_options['woo_post_image_support'] == 'true' && current_theme_supports('post-thumbnails') && function_exists('get_post_thumbnail_id')) {
                $featured_image_id = get_post_thumbnail_id($post->ID);
            } else {
                $featured_image_id = '';
            }
            if ($featured_image_id != '') {
                $html .= '<div class="portfolio-item single-portfolio-image ">';
                $image_data = wp_get_attachment_image_src($featured_image_id, 'full');
                $image_url = $image_data[0];
                $html .= '<a href="' . $image_url . '" rel="' . $rel . '">' . woo_image($args) . '</a>' . "\n";
                $html .= '</div>';
 function woo_portfolio_item_settings($id)
 {
     global $woo_options;
     // Sanity check.
     if (!is_numeric($id)) {
         return;
     }
     $website_layout = 'two-col-left';
     $website_width = '960px';
     if (isset($woo_options['woo_layout'])) {
         $website_layout = $woo_options['woo_layout'];
     }
     if (isset($woo_options['woo_layout_width'])) {
         $website_width = $woo_options['woo_layout_width'];
     }
     $dimensions = woo_portfolio_image_dimensions($website_layout, $website_width);
     $width = $dimensions['width'];
     $height = $dimensions['height'];
     $enable_gallery = false;
     if (isset($woo_options['woo_portfolio_gallery'])) {
         $enable_gallery = $woo_options['woo_portfolio_gallery'];
     }
     $settings = array('large' => '', 'caption' => '', 'rel' => '', 'gallery' => array(), 'css_classes' => 'group post portfolio-img', 'embed' => '', 'enable_gallery' => $enable_gallery, 'testimonial' => '', 'testimonial_author' => '', 'display_url' => '', 'width' => $width, 'height' => $height);
     $meta = get_post_custom($id);
     // Check if there is a gallery in post.
     // woo_get_post_images is offset by 1 by default. Setting to offset by 0 to show all images.
     $large = '';
     if (isset($meta['portfolio-image'][0])) {
         $large = $meta['portfolio-image'][0];
     }
     $caption = '';
     if ($settings['enable_gallery'] == 'true') {
         $gallery = woo_get_post_images('0');
         if ($gallery) {
             // Get first uploaded image in gallery
             $large = $gallery[0]['url'];
             $caption = $gallery[0]['caption'];
         }
     }
     // End IF Statement
     // If we only have one image, disable the gallery functionality.
     if (is_array($gallery) && count($gallery) <= 1) {
         $settings['enable_gallery'] = 'false';
     }
     // Check for a post thumbnail, if support for it is enabled.
     if ($woo_options['woo_post_image_support'] == 'true' && current_theme_supports('post-thumbnails')) {
         $image_id = get_post_thumbnail_id($id);
         if (intval($image_id) > 0) {
             $large_data = wp_get_attachment_image_src($image_id, 'large');
             if (is_array($large_data)) {
                 $large = $large_data[0];
             }
         }
     }
     // See if lightbox-url custom field has a value
     if (isset($meta['lightbox-url']) && $meta['lightbox-url'][0] != '') {
         $large = $meta['lightbox-url'][0];
     }
     // Set rel on anchor to show lightbox
     if (is_array($gallery) && count($gallery) <= 1) {
         $rel = 'rel="lightbox"';
     } else {
         $rel = 'rel="lightbox[' . $id . ']"';
     }
     // Create CSS classes string.
     $css = '';
     $galleries = array();
     $terms = get_the_terms($id, 'portfolio-gallery');
     if (is_array($terms) && count($terms) > 0) {
         foreach ($terms as $t) {
             $galleries[] = $t->slug;
         }
     }
     $css = join(' ', $galleries);
     // If on the single item screen, check for a video.
     if (is_singular()) {
         $settings['embed'] = woo_embed('width=540');
     }
     // Add testimonial information.
     if (isset($meta['testimonial']) && $meta['testimonial'][0] != '') {
         $settings['testimonial'] = $meta['testimonial'][0];
     }
     if (isset($meta['testimonial_author']) && $meta['testimonial_author'][0] != '') {
         $settings['testimonial_author'] = $meta['testimonial_author'][0];
     }
     // Look for a custom display URL of the portfolio item (used if it's a website, for example)
     if (isset($meta['url']) && $meta['url'][0] != '') {
         $settings['display_url'] = $meta['url'][0];
     }
     // Assign the values we have to our array.
     $settings['large'] = $large;
     $settings['caption'] = $caption;
     $settings['rel'] = $rel;
     $settings['gallery'] = $gallery;
     $settings['css_classes'] .= ' ' . $css;
     // Disable "enable_gallery" option is gallery is empty.
     if (!is_array($settings['gallery']) || $settings['gallery'] == '' || count($settings['gallery']) <= 0) {
         $settings['enable_gallery'] = 'false';
     }
     // Allow child themes/plugins to filter these settings.
     $settings = apply_filters('woo_portfolio_item_settings', $settings, $id);
     return $settings;
 }
示例#3
0
        ?>
                                                                        
                <!-- Post Starts -->
                <div class="post block fl <?php 
        echo $porttag;
        ?>
">

					<?php 
        if (woo_image('key=portfolio&return=true')) {
            // Grab large portfolio image
            $large = get_post_meta($post->ID, 'portfolio-large', $single = true);
            if (empty($large) && $woo_options['woo_portfolio_lightbox'] == "true") {
                // Check if there is a gallery in post
                $exclude = get_post_meta($post->ID, 'portfolio', $single = true);
                $gallery = woo_get_post_images();
                if ($gallery) {
                    // Get first uploaded image in gallery
                    $large = $gallery[0]['url'];
                    $caption = $gallery[0]['caption'];
                }
            }
            // Set rel on anchor to show lightbox
            if ($woo_options['woo_portfolio_lightbox'] == "true") {
                $rel = 'rel="prettyPhoto[' . $post->ID . ']"';
            }
            ?>
	                    
                    <a <?php 
            echo $rel;
            ?>