| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
?> |
| 6 |
<section class="yatra-trip-section" id="gallery" itemscope itemtype="https://schema.org/ImageGallery"> |
| 7 |
<h2 class="yatra-trip-section-title"> |
| 8 |
<?php echo yatra_svg_icon('camera', 'yatra-trip-section-title-icon'); ?> |
| 9 |
<?php echo esc_html__('Photo Gallery', 'yatra'); ?> |
| 10 |
</h2> |
| 11 |
<div class="yatra-trip-gallery" data-gallery="hero-gallery"> |
| 12 |
<?php |
| 13 |
global $yatra_hero_gallery_images; |
| 14 |
$gallery_images = array_values(array_filter($yatra_hero_gallery_images ?? [])); |
| 15 |
if (empty($gallery_images)) : |
| 16 |
?> |
| 17 |
<p class="yatra-trip-gallery-empty"><?php echo esc_html__('Photos will appear here when this trip has gallery images.', 'yatra'); ?></p> |
| 18 |
<?php |
| 19 |
else : |
| 20 |
foreach ($gallery_images as $index => $image) : |
| 21 |
?> |
| 22 |
<div class="yatra-gallery-item" data-image-index="<?php echo esc_attr($index); ?>" itemscope itemtype="https://schema.org/ImageObject"> |
| 23 |
<img src="<?php echo esc_url($image); ?>" |
| 24 |
alt="<?php echo esc_attr(sprintf( |
| 25 |
/* translators: 1: photo number, 2: trip title. */ |
| 26 |
__('Photo %1$d of %2$s trip gallery', 'yatra'), |
| 27 |
$index + 1, |
| 28 |
$trip->getTitle() |
| 29 |
)); ?>" |
| 30 |
title="<?php echo esc_attr(sprintf( |
| 31 |
/* translators: 1: photo number, 2: trip title. */ |
| 32 |
__('Photo %1$d - %2$s', 'yatra'), |
| 33 |
$index + 1, |
| 34 |
$trip->getTitle() |
| 35 |
)); ?>" |
| 36 |
itemprop="url" content="<?php echo esc_url($image); ?>" |
| 37 |
data-yatra-src="<?php echo esc_url($image); ?>" |
| 38 |
data-no-lazy="1"> |
| 39 |
<meta itemprop="contentUrl" content="<?php echo esc_url($image); ?>"> |
| 40 |
<meta itemprop="name" content="<?php echo esc_attr(sprintf( |
| 41 |
/* translators: 1: photo number, 2: trip title. */ |
| 42 |
__('Photo %1$d - %2$s', 'yatra'), |
| 43 |
$index + 1, |
| 44 |
$trip->getTitle() |
| 45 |
)); ?>"> |
| 46 |
<meta itemprop="description" content="<?php echo esc_attr(sprintf( |
| 47 |
/* translators: 1: photo number, 2: trip title. */ |
| 48 |
__('Photo %1$d from the %2$s trip gallery', 'yatra'), |
| 49 |
$index + 1, |
| 50 |
$trip->getTitle() |
| 51 |
)); ?>"> |
| 52 |
<meta itemprop="position" content="<?php echo $index + 1; ?>"> |
| 53 |
<meta itemprop="encodingFormat" content="image/jpeg"> |
| 54 |
</div> |
| 55 |
<?php |
| 56 |
endforeach; |
| 57 |
endif; |
| 58 |
?> |
| 59 |
</div> |
| 60 |
</section> |