| 1 |
<?php |
| 2 |
/** |
| 3 |
* Single Property Thumbnails |
| 4 |
* |
| 5 |
* @author PropertyHive |
| 6 |
* @package PropertyHive/Templates |
| 7 |
* @version 1.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 11 |
|
| 12 |
global $post, $propertyhive, $property; |
| 13 |
|
| 14 |
$gallery_attachments = $property->get_gallery_attachment_ids(); |
| 15 |
|
| 16 |
if ( !empty($gallery_attachments) ) { |
| 17 |
?> |
| 18 |
<div class="thumbnails flexslider" id="carousel"> |
| 19 |
|
| 20 |
<ul class="slides"> |
| 21 |
<?php |
| 22 |
|
| 23 |
$loop = 0; |
| 24 |
$columns = apply_filters( 'propertyhive_property_thumbnails_columns', 3 ); |
| 25 |
|
| 26 |
foreach ( $gallery_attachments as $attachment_id ) { |
| 27 |
|
| 28 |
$classes = array(); |
| 29 |
|
| 30 |
if ( $loop == 0 || $loop % $columns == 0 ) |
| 31 |
$classes[] = 'first'; |
| 32 |
|
| 33 |
if ( ( $loop + 1 ) % $columns == 0 ) |
| 34 |
$classes[] = 'last'; |
| 35 |
|
| 36 |
$image_link = wp_get_attachment_url( $attachment_id ); |
| 37 |
|
| 38 |
if ( ! $image_link ) |
| 39 |
continue; |
| 40 |
|
| 41 |
$image = wp_get_attachment_image( $attachment_id, apply_filters( 'single_property_small_thumbnail_size', 'thumbnail' ) ); |
| 42 |
$image_class = esc_attr( implode( ' ', $classes ) ); |
| 43 |
$image_title = esc_attr( get_the_title( $attachment_id ) ); |
| 44 |
|
| 45 |
echo '<li>'.apply_filters( 'propertyhive_single_property_image_thumbnail_html', $image, $attachment_id, $post->ID, $image_class ) . '</li>'; |
| 46 |
|
| 47 |
++$loop; |
| 48 |
} |
| 49 |
|
| 50 |
?> |
| 51 |
</ul> |
| 52 |
|
| 53 |
</div> |
| 54 |
<?php |
| 55 |
} |