Advertisement
ryanburnett

Statua gallery-single.php

Aug 25th, 2011
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.97 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. // Link to image attachment page
  40. $imageLink = $attachment_page = get_attachment_link($att_id);
  41. // Link to image file (change href to '. $imageLink[0] .') $imageLink = wp_get_attachment_image_src($att_id, 'full', true);
  42. // $rel = 'rel="prettyPhoto['. $post->ID .']"';
  43. // if($counter == 1) { echo 'style="display:block;"'; }
  44.  
  45. if ( get_option('woo_resize') == "true" && $use_timthumb == "true" )
  46. $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>';
  47. else
  48. $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>';
  49.  
  50. // Save thumbnail
  51. $src = wp_get_attachment_image_src($att_id, $thumb_size, true);
  52. $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";
  53. }
  54. endif; ?>
  55.  
  56. <?php
  57. if ($counter == 1) {
  58. ?><div id="single-gallery-image"><?php
  59. echo $photo_output; // This will show the large photo in the slider
  60. ?></div><?php
  61. } else {
  62. ?>
  63.  
  64. <!-- Start Photo Slider -->
  65. <div id="slides">
  66. <div id="slide-box">
  67. <div class="slides_container col-full" <?php if($counter == 1) { echo 'style="display: block;overflow: hidden;position: relative;"'; }?>>
  68. <?php echo $photo_output; // This will show the large photo in the slider ?>
  69. </div>
  70.  
  71. <?php if ($counter > 1) : ?>
  72.  
  73. <div class="fix"></div>
  74.  
  75. <ul class="pagination">
  76.  
  77. </ul>
  78. <?php endif; ?>
  79.  
  80. <?php if ($woo_options['woo_gallery_slider_pagination_single'] == 'true'): ?>
  81. <div id="slide-nav">
  82. <div class="pagi">
  83. <ul>
  84. <?php echo $thumb_output; // This will show the large photo in the slider ?>
  85. </ul>
  86. </div><!-- /.pagination col-full -->
  87. <?php if ( $counter >= 6 ) { ?>
  88. <a href="#" class="btn-prev"></a>
  89. <a href="#" class="btn-next"></a>
  90. <?php } ?>
  91. </div><!-- /#slide-nav -->
  92. <?php endif; ?>
  93.  
  94. </div><!-- /#slide-box -->
  95. <div class="fix"></div>
  96. </div><!-- /#slides -->
  97. <?php $counter_limit = 6; ?>
  98.  
  99. <?php } ?>
  100. <!-- End Photo Slider -->
  101.  
  102. <?php
  103.  
  104. // Gallery JS
  105.  
  106. } // End If Statement
  107. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement