Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2011
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.67 KB | None | 0 0
  1. <?php
  2. if ( is_single() ) {
  3.  
  4. // Output gallery
  5. global $woo_options;
  6. global $post;
  7. $repeat = 99; // Number of maximum attachments to get
  8. $photo_size = 'large'; // The WP "size" to use for the large image
  9. $thumb_size = 'thumbnail'; // The WP "size" to use for the thumbnail
  10. $thumb_dim = 150; // Size of thumbnails
  11.  
  12. $use_timthumb = false; // Should not be used as it will crop all images to the dimensions set below
  13. $width_setting = 960; // For use with $use_timthumb
  14. $height_setting = 495; // For use with $use_timthumb
  15.  
  16. $id = get_the_id();
  17. $attachments = get_children( array(
  18. 'post_parent' => $id,
  19. 'numberposts' => $repeat,
  20. 'post_type' => 'attachment',
  21. 'post_mime_type' => 'image',
  22. 'order' => 'DESC',
  23. 'orderby' => 'menu_order date')
  24. );
  25. if ( !empty($attachments) ) :
  26. $counter = 0;
  27. $photo_output = '';
  28. $thumb_output = '';
  29. foreach ( $attachments as $att_id => $attachment ) {
  30. $counter++;
  31.  
  32. // Caption text
  33. $caption = "";
  34. if ($attachment->post_excerpt)
  35. $caption = '<span class="photo-caption">'.$attachment->post_excerpt.'</span>';
  36.  
  37. // Save large photo
  38. $src = wp_get_attachment_image_src($att_id, $photo_size, true);
  39. // $rel = 'rel="prettyPhoto['. $post->ID .']"';
  40. // if($counter == 1) { echo 'style="display:block;"'; }
  41.  
  42. if ( get_option('woo_resize') == "true" && $use_timthumb == "true" )
  43. $photo_output .= '<div class="slide slide-'.$counter.'><div class="slide-content '.$photo_content_class.' fl"><a href="'. $src[0] .'" class="thickbox" 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>';
  44. else
  45. $photo_output .= '<div class="slide slide-'.$counter.'><div class="slide-content '.$photo_content_class.' fl"><a href="'. $src[0] .'" class="thickbox" title="'.$attachment->post_excerpt.'"><img src="'. $src[0] .'" class="single-photo" alt="'.$attachment->post_excerpt.'" /></a>'.$caption.'</div>';
  46.  
  47. // Save thumbnail
  48. $src = wp_get_attachment_image_src($att_id, $thumb_size, true);
  49. $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";
  50. }
  51. endif; ?>
  52.  
  53. <?php
  54. if ($counter == 1) {
  55. ?><div id="single-gallery-image"><?php
  56. echo $photo_output; // This will show the large photo in the slider
  57. ?></div><?php
  58. } else {
  59. ?>
  60.  
  61. <!-- Start Photo Slider -->
  62. <div id="slides">
  63. <div id="slide-box">
  64. <div class="slides_container col-full" <?php if($counter == 1) { echo 'style="display: block;overflow: hidden;position: relative;"'; }?>>
  65. <?php echo $photo_output; // This will show the large photo in the slider ?>
  66. </div>
  67.  
  68. <?php if ($counter > 1) : ?>
  69.  
  70. <div class="fix"></div>
  71.  
  72. <ul class="pagination">
  73.  
  74. </ul>
  75. <?php endif; ?>
  76.  
  77. <?php if ($woo_options['woo_gallery_slider_pagination_single'] == 'true'): ?>
  78. <div id="slide-nav">
  79. <div class="pagi">
  80. <ul>
  81. <?php echo $thumb_output; // This will show the large photo in the slider ?>
  82. </ul>
  83. </div><!-- /.pagination col-full -->
  84. <?php if ( $counter >= 6 ) { ?>
  85. <a href="#" class="btn-prev"></a>
  86. <a href="#" class="btn-next"></a>
  87. <?php } ?>
  88. </div><!-- /#slide-nav -->
  89. <?php endif; ?>
  90.  
  91. </div><!-- /#slide-box -->
  92. <div class="fix"></div>
  93. </div><!-- /#slides -->
  94. <?php $counter_limit = 6; ?>
  95.  
  96. <?php } ?>
  97. <!-- End Photo Slider -->
  98.  
  99. <?php
  100.  
  101. // Gallery JS
  102.  
  103. } // End If Statement
  104. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement