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 +55 -19 3.0.4 → 3.0.16 View file →
@@ -30,14 +30,18 @@
30 30 </span>
31 31 </nav>
32 32 <h1 class="yatra-trip-hero-title-new" itemprop="name"><?php echo esc_html($trip->getTitle()); ?></h1>
33 33 <div class="yatra-hero-meta">
34 - <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">
35 36 <?php if ($trip->getAverageRating() > 0 || $trip->getReviewCount() > 0): ?>
36 37 <?php
38 + // Shared helper, so the hero, the reviews block below it and the
39 + // booking confirmation all draw the same rating identically.
37 40 $hero_avg = (float) $trip->getAverageRating();
38 - $hero_full = (int) floor($hero_avg);
39 - $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'];
40 44 ?>
41 45 <div class="yatra-rating-stars">
42 46 <?php for ($i = 1; $i <= 5; $i++) : ?>
43 47 <?php
@@ -48,26 +52,31 @@
48 52 } else {
49 53 $hero_star_class = 'yatra-star';
50 54 }
51 55 ?>
52 - <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>
53 61 <?php endfor; ?>
54 62 </div>
55 - <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>
56 64 <span class="yatra-rating-text">
57 - <span itemprop="reviewCount"><?php echo esc_html($trip->getReviewCount()); ?></span>
65 + <span><?php echo esc_html($trip->getReviewCount()); ?></span>
58 66 <?php echo esc_html(_n('Review', 'Reviews', $trip->getReviewCount(), 'yatra')); ?>
59 67 </span>
60 - <meta itemprop="bestRating" content="5">
61 - <meta itemprop="worstRating" content="1">
62 68 <?php else: ?>
63 69 <div class="yatra-rating-stars yatra-no-rating">
64 70 <?php for ($i = 1; $i <= 5; $i++): ?>
65 - <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>
66 76 <?php endfor; ?>
67 77 </div>
68 78 <span class="yatra-rating-text yatra-no-reviews"><?php echo esc_html__('No reviews yet', 'yatra'); ?></span>
69 - <meta itemprop="reviewCount" content="0">
70 79 <?php endif; ?>
71 80 </div>
72 81 <?php if (!empty($trip->getStartingLocation())): ?>
73 82 <div class="yatra-hero-location" itemprop="location" itemscope itemtype="https://schema.org/Place">
@@ -74,17 +83,29 @@
74 83 <?php echo yatra_svg_icon('map-pin', 'yatra-icon-sm'); ?>
75 84 <span itemprop="name"><?php echo esc_html($trip->getStartingLocation()); ?></span>
76 85 </div>
77 86 <?php endif; ?>
78 - <?php if (!empty($trip->getDurationDays())): ?>
87 + <?php if (!empty($trip->getDurationDays()) || $trip->getDurationHours() > 0): ?>
79 88 <div class="yatra-hero-duration" itemprop="duration">
80 89 <?php echo yatra_svg_icon('clock', 'yatra-icon-sm'); ?>
81 90 <span>
82 - <?php
83 - if (!empty($trip->getDurationNights()) && $trip->getDurationNights() > 0) {
84 - 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 + ));
85 102 } else {
86 - 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 + ));
87 108 }
88 109 ?>
89 110 </span>
90 111 </div>
@@ -192,9 +213,13 @@
192 213
193 214 <?php if (!empty($main_image_url)): ?>
194 215 <a href="#" class="yatra-hero-main-img-link" data-gallery="hero-gallery" data-image-index="0">
195 216 <img src="<?php echo esc_url($main_image_url); ?>"
196 - 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 + )); ?>"
197 222 title="<?php echo esc_attr($trip->getTitle()); ?>"
198 223 itemprop="url" content="<?php echo esc_url($main_image_url); ?>"
199 224 data-yatra-src="<?php echo esc_url($main_image_url); ?>"
200 225 data-no-lazy="1"
@@ -205,9 +230,13 @@
205 230 <meta itemprop="width" content="1200">
206 231 <meta itemprop="height" content="630">
207 232 <?php else: ?>
208 233 <img src="<?php echo esc_url(plugins_url('assets/images/trip-placeholder.svg', YATRA_PLUGIN_FILE)); ?>"
209 - 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 + )); ?>"
210 239 title="<?php echo esc_attr($trip->getTitle()); ?>"
211 240 itemprop="url" content="<?php echo esc_url(plugins_url('assets/images/trip-placeholder.svg', YATRA_PLUGIN_FILE)); ?>"
212 241 class="yatra-hero-main-img">
213 242 <meta itemprop="contentUrl" content="<?php echo esc_url(plugins_url('assets/images/trip-placeholder.svg', YATRA_PLUGIN_FILE)); ?>">
@@ -281,10 +310,13 @@
281 310 data-no-lazy="1">
282 311 <?php if ($index === 0 && function_exists('yatra_wishlist_enabled') && yatra_wishlist_enabled() && !empty($trip->id)) : ?>
283 312 <button type="button" class="yatra-favorite-btn"
284 313 data-trip-id="<?php echo esc_attr((string) $trip->id); ?>"
314 + title="<?php esc_attr_e('Save to wishlist', 'yatra'); ?>"
285 315 aria-label="<?php echo esc_attr__('Save to wishlist', 'yatra'); ?>">
286 - <?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>
287 319 </button>
288 320 <?php endif; ?>
289 321 <?php if ($index === count($side_images) - 1 && $total_images > 4): ?>
290 322 <button type="button" class="yatra-view-all-photos-btn yatra-gallery-play-btn"
@@ -289,9 +321,13 @@
289 321 <?php if ($index === count($side_images) - 1 && $total_images > 4): ?>
290 322 <button type="button" class="yatra-view-all-photos-btn yatra-gallery-play-btn"
291 323 data-gallery="hero-gallery">
292 324 <?php echo yatra_svg_icon('camera', 'yatra-icon-sm'); ?>
293 - <?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 + ); ?>
294 330 </button>
295 331 <?php endif; ?>
296 332 </div>
297 333 <?php endforeach; ?>