Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //////////////////////////////////////////////////////////////
- // This is the file from which you do "get_template_part()" //
- //////////////////////////////////////////////////////////////
- ?>
- <?php
- //// GETS OUR IMAGES
- $query_images_args = array(
- 'post_type' => 'attachment',
- 'post_mime_type' =>'image',
- 'post_status' => 'inherit',
- 'posts_per_page' => -1,
- 'post_parent' => get_the_ID(),
- 'exclude' => get_post_thumbnail_id(),
- 'orderby' => 'menu_order',
- 'order' => 'ASC'
- );
- //All objects Image, less the featured image
- $images = get_posts( $query_images_args );
- //Randomly choose a key from within the $images array
- $key = array_rand( $images, 1 );
- //Get the image id, corresponding to the previous key
- $imageID = $images[$key]->ID;
- //The url of that image
- $featured_image = wp_get_attachment_url($imageID);
- ?>
- <div id="property-gallery">
- <a class="image" href="<?php echo $featured_image ?>" rel="lightbox[gal]" title="<?php the_title(); ?>"><img src="<?php echo ddTimthumb($featured_image, 680, 450) ?>" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" /></a>
- <div id="property-info">
- <div class="left">
- <?php if(get_post_meta(get_the_ID(), 'bedrooms', true)!='') : ?><span class="beds"><?php echo get_post_meta(get_the_ID(), 'bedrooms', true); ?></span><?php endif; ?>
- <?php if(get_post_meta(get_the_ID(), 'bathrooms', true)!='') : ?><span class="baths"><?php echo get_post_meta(get_the_ID(), 'bathrooms', true); ?></span><?php endif; ?>
- <?php if(get_post_meta(get_the_ID(), 'car_spaces', true)!='') : ?><span class="cars"><?php echo get_post_meta(get_the_ID(), 'car_spaces', true); ?></span><?php endif; ?>
- </div>
- <!-- /.left/ -->
- <div class="right">Töötasu: <?php echo format_property_price(get_post_meta(get_the_ID(), 'price', true), get_the_ID()); ?></div>
- </div>
- <!-- /#property-info/ -->
- </div>
- <!-- /#property-gallery/ -->
- <?php
- ///////////////////////////////////////////////////////
- //// GALLERYTHUMBS FOR RESPONSIVE DESIGN
- ///////////////////////////////////////////////////////
- get_template_part('includes/properties/single', 'gallery-responsive');
- ///////////////////////////////////////////////////////
- ?>
- <?php
- //////////////////////////////////////////////////////////////////////////
- // The thumbnails gallery template begins here : gallery-responsive.php//
- ////////////////////////////////////////////////////////////////////////
- //// GETS OUR IMAGES
- $query_images_args = array(
- 'post_type' => 'attachment',
- 'post_mime_type' =>'image',
- 'post_status' => 'inherit',
- 'posts_per_page' => -1,
- 'post_parent' => get_the_ID(),
- 'exclude' => get_post_thumbnail_id(),
- 'orderby' => 'menu_order',
- 'order' => 'ASC',
- );
- //All objects Image, less the featured image
- $images = get_posts( $args );
- ?>
- <div class="sidebar-item not-in-responsive">
- <script type="text/javascript">
- jQuery(document).ready(function() {
- jQuery('#property-gallery-thumbs').propertyGallery();
- });
- </script>
- <ul id="property-gallery-thumbs">
- <?php
- $i = 1;
- /// IF WE HAVE MORE THAN JUST ONE IMAGE
- if( $images ) : foreach( $images as $image ) : setup_postdata( $image ); ++$i;
- ?>
- <li class="thumb<?php if($i==1) { echo ' current'; } ?><?php if($i%3 == 0) { echo ' last'; } ?>">
- <span class="hidden full"><?php echo wp_get_attachment_url( $image->ID ); ?></span>
- <span class="hidden main"><?php echo ddTimthumb(wp_get_attachment_url( $image->ID ), 680, 450); ?></span>
- <span class="thumb"><img src="<?php echo ddTimthumb(wp_get_attachment_url( $image->ID ), 76, 76); ?>" alt="<?php the_title() ?>" title="<?php the_title(); ?>" /></span>
- </li>
- <?php endforeach; wp_reset_postdata(); ?>
- </ul>
- <!-- /#property-gallery-thumbs/ -->
- </div>
- <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement