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
yatra / templates / partials / single-trip / content-testimonials.php

content-testimonials.php in Yatra – Travel Booking & Tour Operator Software 3.0.16, at templates/partials/single-trip/content-testimonials.php

106 lines 5.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Testimonials Section Content Template
4 * Displays testimonials as a separate section
5 */
6
7 if (!defined('ABSPATH')) {
8 exit;
9 }
10
11 // Expected variables: $tab, $trip
12 ?>
13 <section class="yatra-trip-section" id="<?php echo esc_attr($tab->id); ?>">
14 <h2 class="yatra-trip-section-title">
15 <?php yatra_render_tab_icon($tab->icon ?? null, 'message-circle', 'yatra-trip-section-title-icon', $tab->label ?? __('Testimonials', 'yatra')); ?>
16 <?php echo esc_html($tab->label); ?>
17 </h2>
18
19 <div class="yatra-testimonials-content">
20 <?php
21 // Get testimonials from trip data (loaded via SingleTripController)
22 $display_testimonials = $trip->getTestimonials();
23 ?>
24
25 <?php if (!empty($display_testimonials)): ?>
26 <div class="yatra-trip-testimonials">
27 <?php foreach ($display_testimonials as $testimonial): ?>
28 <div class="yatra-testimonial-card">
29 <div class="yatra-testimonial-rating">
30 <?php
31 $rating = !empty($testimonial->rating) ? intval($testimonial->rating) : 5;
32 for ($i = 1; $i <= 5; $i++):
33 echo $i <= $rating ? '�
34 ' : '☆';
35 endfor;
36 ?>
37 </div>
38 <div class="yatra-testimonial-text">
39 <?php echo wp_kses_post($testimonial->content ?? ''); ?>
40 </div>
41 <div class="yatra-testimonial-author">
42 <div class="yatra-testimonial-avatar">
43 <?php
44 // Use default avatar or initials
45 $author_name = !empty($testimonial->author_name) ? $testimonial->author_name : __('Anonymous', 'yatra');
46 $initials = implode('', array_map(function($word) { return strtoupper(substr($word, 0, 1)); }, explode(' ', $author_name)));
47 echo esc_html(substr($initials, 0, 2));
48 ?>
49 </div>
50 <div class="yatra-testimonial-info">
51 <h4 class="yatra-testimonial-name">
52 <?php echo esc_html($author_name); ?>
53 </h4>
54 <p class="yatra-testimonial-location">
55 <?php
56 $trip_date = !empty($testimonial->trip_date) ? $testimonial->trip_date : '';
57 $location = !empty($testimonial->location) ? $testimonial->location : '';
58
59 if ($trip_date && $location) {
60 echo esc_html(sprintf(
61 /* translators: 1: trip date, 2: location name. */
62 __('Traveled %1$s in %2$s', 'yatra'),
63 $trip_date,
64 $location
65 ));
66 } elseif ($trip_date) {
67 echo esc_html(sprintf(
68 /* translators: %s: trip date. */
69 __('Traveled %s', 'yatra'),
70 $trip_date
71 ));
72 } elseif ($location) {
73 echo esc_html(sprintf(
74 /* translators: %s: location name. */
75 __('Traveled in %s', 'yatra'),
76 $location
77 ));
78 } else {
79 echo esc_html__('Verified Traveler', 'yatra');
80 }
81 ?>
82 </p>
83 </div>
84 </div>
85 </div>
86 <?php endforeach; ?>
87 </div>
88 <?php else: ?>
89 <div class="yatra-testimonials-empty">
90 <div class="yatra-testimonials-empty-icon">
91 <?php echo yatra_svg_icon('message-circle', 'yatra-testimonials-empty-svg'); ?>
92 </div>
93 <h3 class="yatra-testimonials-empty-title">
94 <?php echo esc_html__('No testimonials yet', 'yatra'); ?>
95 </h3>
96 <p class="yatra-testimonials-empty-text">
97 <?php echo esc_html__('Be the first to share your experience on this amazing trip!', 'yatra'); ?>
98 </p>
99 <a href="#reviews" class="yatra-testimonials-empty-cta">
100 <?php echo esc_html__('Write a Review', 'yatra'); ?>
101 </a>
102 </div>
103 <?php endif; ?>
104 </div>
105 </section>
106