Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ( is_single() ) {
- // Output gallery
- global $woo_options;
- global $post;
- $repeat = 99; // Number of maximum attachments to get
- $photo_size = 'large'; // The WP "size" to use for the large image
- $thumb_size = 'thumbnail'; // The WP "size" to use for the thumbnail
- $thumb_dim = 150; // Size of thumbnails
- $use_timthumb = false; // Should not be used as it will crop all images to the dimensions set below
- $width_setting = 960; // For use with $use_timthumb
- $height_setting = 495; // For use with $use_timthumb
- $id = get_the_id();
- $attachments = get_children( array(
- 'post_parent' => $id,
- 'numberposts' => $repeat,
- 'post_type' => 'attachment',
- 'post_mime_type' => 'image',
- 'order' => 'DESC',
- 'orderby' => 'menu_order date')
- );
- if ( !empty($attachments) ) :
- $counter = 0;
- $photo_output = '';
- $thumb_output = '';
- foreach ( $attachments as $att_id => $attachment ) {
- $counter++;
- // Caption text
- $caption = "";
- if ($attachment->post_excerpt)
- $caption = '<span class="photo-caption">'.$attachment->post_excerpt.'</span>';
- // Save large photo
- $src = wp_get_attachment_image_src($att_id, $photo_size, true);
- // Link to image attachment page
- $imageLink = $attachment_page = get_attachment_link($att_id);
- // Link to image file (change href to '. $imageLink[0] .') $imageLink = wp_get_attachment_image_src($att_id, 'full', true);
- // $rel = 'rel="prettyPhoto['. $post->ID .']"';
- // if($counter == 1) { echo 'style="display:block;"'; }
- if ( get_option('woo_resize') == "true" && $use_timthumb == "true" )
- $photo_output .= '<div class="slide slide-'.$counter.'><div class="slide-content '.$photo_content_class.' fl"><a href="'. $imageLink .'" title="'.$attachment->post_excerpt.'"><img src="'. get_bloginfo('template_url').'/thumb.php?src='. $src[0] .'&h='.$height_setting.'&w='.$width_setting.'&q=90&zc=1" class="single-photo" alt="'.$caption.'" /></a>'.$attachment->post_excerpt.'</div>';
- else
- $photo_output .= '<div class="slide slide-'.$counter.'><div class="slide-content '.$photo_content_class.' fl"><a href="'. $imageLink .'" title="'.$attachment->post_excerpt.'"><img src="'. $src[0] .'" class="single-photo" alt="'.$attachment->post_excerpt.'" /></a>'.$caption.'</div>';
- // Save thumbnail
- $src = wp_get_attachment_image_src($att_id, $thumb_size, true);
- $thumb_output .= '<li><a href="#"><img src="'. $src[0] .'" height="'.$thumb_dim.'" width="'.$thumb_dim.'" class="single-thumb" alt="'.$attachment->post_excerpt.'" />' . "</a></li>\n";
- }
- endif; ?>
- <?php
- if ($counter == 1) {
- ?><div id="single-gallery-image"><?php
- echo $photo_output; // This will show the large photo in the slider
- ?></div><?php
- } else {
- ?>
- <!-- Start Photo Slider -->
- <div id="slides">
- <div id="slide-box">
- <div class="slides_container col-full" <?php if($counter == 1) { echo 'style="display: block;overflow: hidden;position: relative;"'; }?>>
- <?php echo $photo_output; // This will show the large photo in the slider ?>
- </div>
- <?php if ($counter > 1) : ?>
- <div class="fix"></div>
- <ul class="pagination">
- </ul>
- <?php endif; ?>
- <?php if ($woo_options['woo_gallery_slider_pagination_single'] == 'true'): ?>
- <div id="slide-nav">
- <div class="pagi">
- <ul>
- <?php echo $thumb_output; // This will show the large photo in the slider ?>
- </ul>
- </div><!-- /.pagination col-full -->
- <?php if ( $counter >= 6 ) { ?>
- <a href="#" class="btn-prev"></a>
- <a href="#" class="btn-next"></a>
- <?php } ?>
- </div><!-- /#slide-nav -->
- <?php endif; ?>
- </div><!-- /#slide-box -->
- <div class="fix"></div>
- </div><!-- /#slides -->
- <?php $counter_limit = 6; ?>
- <?php } ?>
- <!-- End Photo Slider -->
- <?php
- // Gallery JS
- } // End If Statement
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement