Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 31st, 2012  |  syntax: None  |  size: 2.87 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. $use_timthumb = false;          // Set to false to disable for this section of theme. Images will be downsized instead of resized to 640px width
  4. $repeat = 100;                          // Number of maximum attachments to get
  5. $photo_size = 'large';          // The WP "size" to use for the large image
  6. $thumb_size = 'thumbnail';      // The WP "size" to use for the thumbnail
  7. $thumb_dim = 70;                        // Size of thumbnails
  8.  
  9. $id = get_the_id();
  10. $attachments = get_children( array(
  11. 'post_parent' => $id,
  12. 'numberposts' => $repeat,
  13. 'post_type' => 'attachment',
  14. 'post_mime_type' => 'image',
  15. 'order' => 'DESC',
  16. 'orderby' => 'menu_order date')
  17. );
  18. if ( !empty($attachments) ) :
  19.         $counter = 0;
  20.         $photo_output = '';
  21.         $thumb_output = '';    
  22.         foreach ( $attachments as $att_id => $attachment ) {
  23.                 $counter++;
  24.                
  25.                 // Caption text
  26.                 $caption = "";
  27.                 if ($attachment->post_excerpt)
  28.                         $caption = '<span class="photo-caption">'.$attachment->post_excerpt.'</span>'; 
  29.                        
  30.                 // Save large photo
  31.                 $src = wp_get_attachment_image_src($att_id, $photo_size, true);
  32.                 if ( get_option('woo_resize') == "true" && $use_timthumb == "true" )
  33.                         $photo_output .= '<div><a href="'. $src[0] .'" rel="lightbox-group"><img src="'. get_bloginfo(template_url).'/thumb.php?src='. $src[0] .'&h=&w=680&q=90&zc=1" class="single-photo" alt="'.$caption.'" /></a>'.$attachment->post_excerpt.'</div>';              
  34.                 else
  35.                         $photo_output .= '<div><a href="'. $src[0] .'" rel="lightbox-group"><img src="'. $src[0] .'" width="680" class="single-photo" alt="'.$attachment->post_excerpt.'" /></a>'.$caption.'</div>';
  36.                
  37.                 // Save thumbnail
  38.                 $src = wp_get_attachment_image_src($att_id, $thumb_size, true);
  39.                 $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";
  40.         }  
  41. endif;
  42.  
  43. if ( $counter > 1) {
  44. ?>
  45.  
  46. <!-- Start Photo Slider -->
  47. <div id="loopedSlider">
  48.     <ul class="pagination">
  49.                 <?php echo $thumb_output; // This will show the small thumbnails ?>
  50.     </ul>                      
  51.     <div class="container">
  52.         <div class="slides">
  53.             <?php echo $photo_output; // This will show the large photo in the slider ?>
  54.         </div>
  55.     </div>
  56.    
  57.     <?php if ($counter > 1) : ?>
  58.                 <?php if (get_option("woo_slider_disable_nav") == "false") { ?>
  59.     <a href="#" class="previous"><img src="<?php bloginfo('template_directory'); ?>/images/prev-slider.png" alt="" /></a>
  60.     <a href="#" class="next"><img src="<?php bloginfo('template_directory'); ?>/images/next-slider.png" alt="" /></a>                    
  61.                 <?php } ?>                                      
  62.     <?php endif; ?>
  63.    
  64. <div class="fix"></div>
  65. </div>
  66. <!-- End Photo Slider -->
  67.  
  68. <?php } else { ?>
  69.  
  70. <div class="single-image" style="margin-bottom:20px;">
  71.         <?php echo $photo_output; // This will show the large photo in the slider ?>
  72. </div>
  73.  
  74. <?php } ?>