Guest User

Untitled

a guest
Feb 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. <?php
  2. global $woo_options;
  3. global $post;
  4. $use_timthumb = false; // Set to false to disable for this section of theme. Images will be downsized instead of resized to 640px width
  5. $repeat = 20; // Number of maximum attachments to get
  6. $photo_size = 'large'; // The WP "size" to use for the large image
  7. $thumb_size = 'thumbnail'; // The WP "size" to use for the thumbnail
  8. $thumb_dim = 66; // Size of thumbnails
  9. if ( $post->post_type == 'woo_estate' ) {
  10. $woo_layout_setting = $woo_options['woo_property_single_layout'];
  11. } else {
  12. $woo_layout_setting = $woo_options['woo_single_layout'];
  13. }
  14.  
  15. if($woo_layout_setting == "Without Sidebar" ) {
  16. $width_setting = 374;
  17. } else {
  18. $width_setting = 594;
  19. }
  20.  
  21. $id = get_the_id();
  22. $attachments = get_children( array(
  23. 'post_parent' => $id,
  24. 'numberposts' => $repeat,
  25. 'post_type' => 'attachment',
  26. 'post_mime_type' => 'image',
  27. 'order' => 'DESC',
  28. 'orderby' => 'menu_order date')
  29. );
  30. if ( !empty($attachments) ) :
  31. $counter = 0;
  32. $photo_output = '';
  33. $thumb_output = '';
  34. foreach ( $attachments as $att_id => $attachment ) {
  35. $counter++;
  36.  
  37. $alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true);
  38.  
  39. // Caption text
  40. $caption = "";
  41. if ($attachment->post_excerpt)
  42. $caption = '<span class="photo-caption">'.$attachment->post_excerpt.'</span>';
  43.  
  44. // Save large photo
  45. $src = wp_get_attachment_image_src($att_id, $photo_size, true);
  46. if ( get_option('woo_resize') == "true" && $use_timthumb == "true" )
  47. $photo_output .= '<div><a href="'. $src[0] .'" rel="lightbox-group" class="thickbox" title="'.$attachment->post_excerpt.'">' . woo_image( 'src=' . $src[0] . '&width='.$width_setting.'&class=single-photo&meta=' . $alt . '&return=true' ) . '</a>'.$caption.'</div>';
  48. else
  49. $photo_output .= '<div><a href="'. $src[0] .'" rel="lightbox-group" class="thickbox" title="'.$attachment->post_excerpt.'"><img src="'. $src[0] .'" width="'.$width_setting.'" class="single-photo" alt="'. $alt .'" /></a>'.$caption.'</div>';
  50.  
  51. // Save thumbnail
  52. $src = wp_get_attachment_image_src($att_id, $thumb_size, true);
  53. $thumb_output .= '<li><a href="#"><img src="'. $src[0] .'" height="'.$thumb_dim.'" width="'.$thumb_dim.'" class="single-thumb" alt="'. $alt .'" />' . "</a></li>\n";
  54. }
  55. endif; ?>
  56.  
  57. <?php
  58. if ($counter == 1) {
  59. ?><div id="single-gallery-image"><?php
  60. echo $photo_output; // This will show the large photo in the slider
  61. ?></div><?php
  62. } else {
  63. ?>
  64.  
  65. <!-- Start Photo Slider -->
  66. <div id="loopedSlider" class="gallery <?php if($woo_layout_setting == "Without Sidebar" ) { ?>no-sidebar<?php } else { ?>sidebar<?php } ?>">
  67. <div class="container">
  68. <div class="slides">
  69. <?php echo $photo_output; // This will show the large photo in the slider ?>
  70. </div>
  71. </div>
  72.  
  73. <?php if ($counter > 1) : ?>
  74.  
  75. <div class="fix"></div>
  76.  
  77. <ul class="pagination">
  78. <?php echo $thumb_output; // This will show the large photo in the slider ?>
  79. </ul>
  80. <?php endif; ?>
  81.  
  82. <div class="fix"></div>
  83. </div>
  84. <?php if (get_option("woo_property_single_layout") == "With sidebar") { $counter_limit = 7; } else { $counter_limit = 5; } ?>
  85. <?php if ($counter < $counter_limit) { ?>
  86. <style type="text/css">
  87.  
  88. .jcarousel-prev { display:none!important; }
  89. .jcarousel-next { display:none!important; }
  90.  
  91. </style>
  92. <?php } ?>
  93. <?php } ?>
  94. <!-- End Photo Slider -->
Add Comment
Please, Sign In to add comment