PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
← All changes | templates/partials/single-trip/hero.php +59 -20 3.0.2.9 → 3.0.16 View file →
@@ -2,8 +2,11 @@
2 2 if (!defined('ABSPATH')) {
3 3 exit;
4 4 }
5 5 $booking_disabled = isset($trip) && method_exists($trip, 'isBookingDisabled') && $trip->isBookingDisabled();
6 +$yatra_hero_dp_flags = function_exists('yatra_get_dynamic_pricing_display_flags') ? yatra_get_dynamic_pricing_display_flags() : [
7 + 'show_savings_badge' => true,
8 +];
6 9 ?>
7 10 <div class="yatra-trip-hero-new" itemscope itemtype="https://schema.org/TouristTrip">
8 11 <div class="yatra-hero-header">
9 12 <nav class="yatra-hero-breadcrumb" aria-label="<?php echo esc_attr__('Breadcrumb', 'yatra'); ?>" itemscope itemtype="https://schema.org/BreadcrumbList">
@@ -27,14 +30,18 @@
27 30 </span>
28 31 </nav>
29 32 <h1 class="yatra-trip-hero-title-new" itemprop="name"><?php echo esc_html($trip->getTitle()); ?></h1>
30 33 <div class="yatra-hero-meta">
31 - <div class="yatra-hero-rating" itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
34 + <?php // Rating is expressed via JSON-LD (Product.aggregateRating) in SEOService — no microdata here, which Google rejected on a TouristTrip parent. ?>
35 + <div class="yatra-hero-rating">
32 36 <?php if ($trip->getAverageRating() > 0 || $trip->getReviewCount() > 0): ?>
33 37 <?php
38 + // Shared helper, so the hero, the reviews block below it and the
39 + // booking confirmation all draw the same rating identically.
34 40 $hero_avg = (float) $trip->getAverageRating();
35 - $hero_full = (int) floor($hero_avg);
36 - $hero_half = ($hero_avg - $hero_full) >= 0.3;
41 + $hero_parts = yatra_rating_star_parts($hero_avg);
42 + $hero_full = $hero_parts['full'];
43 + $hero_half = $hero_parts['half'];
37 44 ?>
38 45 <div class="yatra-rating-stars">
39 46 <?php for ($i = 1; $i <= 5; $i++) : ?>
40 47 <?php
@@ -45,26 +52,31 @@
45 52 } else {
46 53 $hero_star_class = 'yatra-star';
47 54 }
48 55 ?>
49 - <span class="<?php echo esc_attr($hero_star_class); ?>" aria-label="<?php echo esc_attr(sprintf(_n('%d star', '%d stars', $i, 'yatra'), $i)); ?>">★</span>
56 + <span class="<?php echo esc_attr($hero_star_class); ?>" aria-label="<?php echo esc_attr(sprintf(
57 + /* translators: %d: star rating number (1-5). */
58 + _n('%d star', '%d stars', $i, 'yatra'),
59 + $i
60 + )); ?>">★</span>
50 61 <?php endfor; ?>
51 62 </div>
52 - <span class="yatra-rating-number" itemprop="ratingValue"><?php echo esc_html(number_format($trip->getAverageRating(), 1)); ?></span>
63 + <span class="yatra-rating-number"><?php echo esc_html(number_format($trip->getAverageRating(), 1)); ?></span>
53 64 <span class="yatra-rating-text">
54 - <span itemprop="reviewCount"><?php echo esc_html($trip->getReviewCount()); ?></span>
65 + <span><?php echo esc_html($trip->getReviewCount()); ?></span>
55 66 <?php echo esc_html(_n('Review', 'Reviews', $trip->getReviewCount(), 'yatra')); ?>
56 67 </span>
57 - <meta itemprop="bestRating" content="5">
58 - <meta itemprop="worstRating" content="1">
59 68 <?php else: ?>
60 69 <div class="yatra-rating-stars yatra-no-rating">
61 70 <?php for ($i = 1; $i <= 5; $i++): ?>
62 - <span class="yatra-star" aria-label="<?php echo esc_attr(sprintf(_n('%d star', '%d stars', $i, 'yatra'), $i)); ?>">★</span>
71 + <span class="yatra-star" aria-label="<?php echo esc_attr(sprintf(
72 + /* translators: %d: star rating number (1-5). */
73 + _n('%d star', '%d stars', $i, 'yatra'),
74 + $i
75 + )); ?>">★</span>
63 76 <?php endfor; ?>
64 77 </div>
65 78 <span class="yatra-rating-text yatra-no-reviews"><?php echo esc_html__('No reviews yet', 'yatra'); ?></span>
66 - <meta itemprop="reviewCount" content="0">
67 79 <?php endif; ?>
68 80 </div>
69 81 <?php if (!empty($trip->getStartingLocation())): ?>
70 82 <div class="yatra-hero-location" itemprop="location" itemscope itemtype="https://schema.org/Place">
@@ -71,17 +83,29 @@
71 83 <?php echo yatra_svg_icon('map-pin', 'yatra-icon-sm'); ?>
72 84 <span itemprop="name"><?php echo esc_html($trip->getStartingLocation()); ?></span>
73 85 </div>
74 86 <?php endif; ?>
75 - <?php if (!empty($trip->getDurationDays())): ?>
87 + <?php if (!empty($trip->getDurationDays()) || $trip->getDurationHours() > 0): ?>
76 88 <div class="yatra-hero-duration" itemprop="duration">
77 89 <?php echo yatra_svg_icon('clock', 'yatra-icon-sm'); ?>
78 90 <span>
79 - <?php
80 - if (!empty($trip->getDurationNights()) && $trip->getDurationNights() > 0) {
81 - echo esc_html(sprintf(_n('%d day %d night', '%d days %d nights', $trip->getDurationDays(), 'yatra'), $trip->getDurationDays(), $trip->getDurationNights()));
91 + <?php
92 + if ($trip->getDurationHours() > 0) {
93 + // Hour-based day tour: "8 hours", not "1 day" (matches quick-facts).
94 + echo esc_html(yatra_format_duration(0, null, $trip->getDurationHours()));
95 + } elseif (!empty($trip->getDurationNights()) && $trip->getDurationNights() > 0) {
96 + echo esc_html(sprintf(
97 + /* translators: 1: number of days, 2: number of nights. */
98 + _n('%1$d day %2$d night', '%1$d days %2$d nights', $trip->getDurationDays(), 'yatra'),
99 + $trip->getDurationDays(),
100 + $trip->getDurationNights()
101 + ));
82 102 } else {
83 - echo esc_html(sprintf(_n('%d day', '%d days', $trip->getDurationDays(), 'yatra'), $trip->getDurationDays()));
103 + echo esc_html(sprintf(
104 + /* translators: %d: number of days. */
105 + _n('%d day', '%d days', $trip->getDurationDays(), 'yatra'),
106 + $trip->getDurationDays()
107 + ));
84 108 }
85 109 ?>
86 110 </span>
87 111 </div>
@@ -133,9 +157,9 @@
133 157 $total_images = count($all_gallery_images);
134 158 ?>
135 159 <div class="yatra-hero-images">
136 160 <div class="yatra-hero-main-image" itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
137 - <?php if (isset($trip->discount_percentage) && $trip->discount_percentage > 0): ?>
161 + <?php if (isset($trip->discount_percentage) && $trip->discount_percentage > 0 && !empty($yatra_hero_dp_flags['show_savings_badge'])): ?>
138 162 <div class="yatra-hero-discount-tag" itemprop="offers" itemscope itemtype="https://schema.org/Offer">
139 163 <?php echo esc_html__('SAVE UP TO', 'yatra'); ?> <?php echo esc_html($trip->discount_percentage); ?>%
140 164 <meta itemprop="discount" content="<?php echo esc_attr($trip->discount_percentage); ?>">
141 165 <meta itemprop="discountCurrency" content="<?php echo esc_attr(\Yatra\Services\SettingsService::getCurrency()); ?>">
@@ -189,9 +213,13 @@
189 213
190 214 <?php if (!empty($main_image_url)): ?>
191 215 <a href="#" class="yatra-hero-main-img-link" data-gallery="hero-gallery" data-image-index="0">
192 216 <img src="<?php echo esc_url($main_image_url); ?>"
193 - alt="<?php echo esc_attr(sprintf(__('Main image for %s', 'yatra'), $trip->getTitle())); ?>"
217 + alt="<?php echo esc_attr(sprintf(
218 + /* translators: %s: trip title. */
219 + __('Main image for %s', 'yatra'),
220 + $trip->getTitle()
221 + )); ?>"
194 222 title="<?php echo esc_attr($trip->getTitle()); ?>"
195 223 itemprop="url" content="<?php echo esc_url($main_image_url); ?>"
196 224 data-yatra-src="<?php echo esc_url($main_image_url); ?>"
197 225 data-no-lazy="1"
@@ -202,9 +230,13 @@
202 230 <meta itemprop="width" content="1200">
203 231 <meta itemprop="height" content="630">
204 232 <?php else: ?>
205 233 <img src="<?php echo esc_url(plugins_url('assets/images/trip-placeholder.svg', YATRA_PLUGIN_FILE)); ?>"
206 - alt="<?php echo esc_attr(sprintf(__('Placeholder image for %s', 'yatra'), $trip->getTitle())); ?>"
234 + alt="<?php echo esc_attr(sprintf(
235 + /* translators: %s: trip title. */
236 + __('Placeholder image for %s', 'yatra'),
237 + $trip->getTitle()
238 + )); ?>"
207 239 title="<?php echo esc_attr($trip->getTitle()); ?>"
208 240 itemprop="url" content="<?php echo esc_url(plugins_url('assets/images/trip-placeholder.svg', YATRA_PLUGIN_FILE)); ?>"
209 241 class="yatra-hero-main-img">
210 242 <meta itemprop="contentUrl" content="<?php echo esc_url(plugins_url('assets/images/trip-placeholder.svg', YATRA_PLUGIN_FILE)); ?>">
@@ -278,10 +310,13 @@
278 310 data-no-lazy="1">
279 311 <?php if ($index === 0 && function_exists('yatra_wishlist_enabled') && yatra_wishlist_enabled() && !empty($trip->id)) : ?>
280 312 <button type="button" class="yatra-favorite-btn"
281 313 data-trip-id="<?php echo esc_attr((string) $trip->id); ?>"
314 + title="<?php esc_attr_e('Save to wishlist', 'yatra'); ?>"
282 315 aria-label="<?php echo esc_attr__('Save to wishlist', 'yatra'); ?>">
283 - <?php echo yatra_svg_icon('heart', 'yatra-icon-sm'); ?>
316 + <svg width="20" height="20" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
317 + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/>
318 + </svg>
284 319 </button>
285 320 <?php endif; ?>
286 321 <?php if ($index === count($side_images) - 1 && $total_images > 4): ?>
287 322 <button type="button" class="yatra-view-all-photos-btn yatra-gallery-play-btn"
@@ -286,9 +321,13 @@
286 321 <?php if ($index === count($side_images) - 1 && $total_images > 4): ?>
287 322 <button type="button" class="yatra-view-all-photos-btn yatra-gallery-play-btn"
288 323 data-gallery="hero-gallery">
289 324 <?php echo yatra_svg_icon('camera', 'yatra-icon-sm'); ?>
290 - <?php echo sprintf(esc_html__('View all %d photos', 'yatra'), $total_images); ?>
325 + <?php echo sprintf(
326 + /* translators: %d: total number of photos in the trip gallery. */
327 + esc_html__('View all %d photos', 'yatra'),
328 + $total_images
329 + ); ?>
291 330 </button>
292 331 <?php endif; ?>
293 332 </div>
294 333 <?php endforeach; ?>