Advertisement
Guest User

Untitled

a guest
Aug 5th, 2013
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1.  
  2.  
  3. <?php
  4.  
  5. //// GETS OUR IMAGES
  6. $query_images_args = array(
  7.  
  8. 'post_type' => 'attachment',
  9. 'post_mime_type' =>'image',
  10. 'post_status' => 'inherit',
  11. 'posts_per_page' => -1,
  12. 'post_parent' => get_the_ID(),
  13. 'orderby' => 'menu_order',
  14. 'order' => 'ASC',
  15.  
  16. );
  17.  
  18. $query_images = new WP_Query( $query_images_args );
  19.  
  20. $images = array();
  21. $featured = getFeaturedImage(get_the_ID());
  22. $images[] = $featured;
  23.  
  24. foreach ( $query_images->posts as $image) {
  25.  
  26. //// MAKES SURE WE DONT INCLUDE OUR FEATURED IMAGE
  27. $this_image = wp_get_attachment_url( $image->ID );
  28.  
  29. if($this_image != $featured[0]) {
  30.  
  31. $images[]= array(
  32.  
  33. $this_image,
  34. 'caption' => $image->post_excerpt
  35.  
  36. );
  37.  
  38. }
  39.  
  40. }
  41.  
  42. /// IF WE HAVE MORE THAN JUST ONE IMAGE
  43. if(count($query_images->posts) >= 2) :
  44.  
  45. ?>
  46.  
  47. <div class="sidebar-item not-in-responsive">
  48.  
  49. <script type="text/javascript">
  50.  
  51. jQuery(document).ready(function() {
  52.  
  53. jQuery('#property-gallery-thumbs').propertyGallery();
  54.  
  55. });
  56.  
  57. </script>
  58.  
  59. <ul id="property-gallery-thumbs">
  60.  
  61. <?php
  62.  
  63. //// LOOPS EACH IMAGE
  64. $i = 1;
  65. foreach($images as $image) :
  66.  
  67. ?>
  68.  
  69. <li class="thumb<?php if($i==1) { echo ' current'; } ?><?php if($i%3 == 0) { echo ' last'; } ?>">
  70.  
  71. <span class="hidden full"><?php echo $image[0]; ?></span>
  72. <span class="hidden main"><?php echo ddTimthumb($image[0], 680, 450); ?></span>
  73. <span class="thumb"><img src="<?php echo ddTimthumb($image[0], 76, 76); ?>" alt="<?php the_title() ?>" title="<?php the_title(); ?>" /></span>
  74.  
  75. </li>
  76.  
  77. <?php $i++; endforeach; ?>
  78.  
  79. </ul>
  80. <!-- /#property-gallery-thumbs/ -->
  81.  
  82. </div>
  83.  
  84. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement