PluginProbe
Yatra – Travel Booking & Tour Operator Software / 2.0.1
Yatra – Travel Booking & Tour Operator Software v2.0.1
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 2.0.10 2.0.11 All 82 releases
yatra / includes / template-tags.php

template-tags.php in Yatra – Travel Booking & Tour Operator Software 2.0.1, at includes/template-tags.php

893 lines 33.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined('ABSPATH') || exit;
4 if (!function_exists('yatra_get_taxonomy_term_lists')) {
5 function yatra_get_taxonomy_term_lists($post_id, $taxonomy = '')
6 {
7 /* translators: used between list items, there is a space after the comma. */
8 $terms = get_the_term_list($post_id, $taxonomy, '', __(', ', 'yatra'));
9
10 if ($terms) {
11 printf(
12 /* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of categories. */
13 '<span class="cat-links"><span class="screen-reader-text">%1$s</span>%2$s</span>',
14 __('Posted in', 'yatra'),
15 $terms
16 ); // WPCS: XSS OK.
17 }
18
19 // /* translators: used between list items, there is a space after the comma. */
20 // $tags_list = get_the_tag_list('', __(', ', 'yatra'));
21 // if ($tags_list) {
22 // printf(
23 // /* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of tags. */
24 // '<span class="tags-links">%1$s<span class="screen-reader-text">%2$s </span>%3$s</span>',
25 // yatra_get_icon_svg('tag', 16),
26 // __('Tags:', 'yatra'),
27 // $tags_list
28 // ); // WPCS: XSS OK.
29 // }
30 }
31 }
32
33 if (!function_exists('yatra_entry_header')) {
34
35 function yatra_entry_header()
36 {
37 ?>
38 <header class="entry-header">
39 <?php
40 if (is_sticky() && is_home() && !is_paged()) {
41 printf('<span class="sticky-post">%s</span>', _x('Featured', 'post', 'yatra'));
42 }
43 if (is_singular()) :
44 the_title('<h1 class="entry-title">', '</h1>');
45 else :
46 the_title(sprintf('<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>');
47 endif;
48 ?>
49 <div class="entry-meta">
50 <?php
51 yatra_get_taxonomy_term_lists(get_the_ID(), 'destination');
52 ?></div>
53 </header><!-- .entry-header -->
54 <?php
55 }
56 }
57
58 if (!function_exists('yatra_post_thumbnail')) {
59
60 function yatra_post_thumbnail($size = "post-thumbnail")
61 {
62 ?>
63 <figure class="post-thumbnail">
64 <a class="post-thumbnail-inner" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
65 <?php the_post_thumbnail($size); ?>
66 </a>
67 </figure>
68 <?php
69 }
70 }
71
72 if (!function_exists('yatra_entry_post_content')) {
73
74 function yatra_entry_post_content()
75 {
76 ?>
77 <div class="entry-content">
78 <?php
79 the_excerpt();
80 ?>
81 </div><!-- .entry-content -->
82 <?php
83 }
84 }
85
86 if (!function_exists('yatra_entry_footer')) {
87
88 function yatra_entry_footer()
89 {
90 ?>
91 <div class="entry-footer">
92 <?php
93 yatra_posted_by();
94 yatra_posted_on();
95 yatra_get_taxonomy_term_lists(get_the_ID(), 'destination'); ?>
96 </div>
97 <?php
98 }
99 }
100
101 if (!function_exists('yatra_get_current_currency_symbol')) {
102 function yatra_get_current_currency_symbol()
103 {
104 $currency = get_option('yatra_currency');
105
106 $currency_symbol = yatra_get_currency_symbols($currency);
107
108 return $currency_symbol;
109 }
110 }
111
112 if (!function_exists('yatra_entry_meta_for_frontend_archive')) {
113
114 function yatra_entry_meta_for_frontend_archive($post_id)
115 {
116
117 $currency_symbol = yatra_get_current_currency_symbol();
118
119 $regular_yatra_tour_meta_regular_price = get_post_meta($post_id, 'yatra_tour_meta_regular_price', true);
120
121 $yatra_tour_meta_sales_price = get_post_meta($post_id, 'yatra_tour_meta_sales_price', true);
122
123 $yatra_tour_meta_tour_country = get_post_meta($post_id, 'yatra_tour_meta_tour_country', true);
124
125 $yatra_tour_meta_regular_price_string = $currency_symbol . $regular_yatra_tour_meta_regular_price;
126
127 if ((int)$yatra_tour_meta_sales_price > 0) {
128
129 $yatra_tour_meta_regular_price_string = '<del>' . $yatra_tour_meta_regular_price_string . '</del> &nbsp;' . $currency_symbol . $yatra_tour_meta_sales_price;;
130
131 }
132
133
134 $meta_frontend = array(
135
136 array(
137 'icon' => 'fa fa-money',
138 'text' => $yatra_tour_meta_regular_price_string,
139 'title' => __('Price', 'yatra')
140
141 ),
142 array(
143 'icon' => 'fa fa-user',
144 'text' => '{{yatra_tour_meta_price_per}}',
145 'title' => __('Price Per', 'yatra')
146
147 ), array(
148 'icon' => 'fa fa-user-circle',
149 'text' => '{{yatra_tour_meta_group_size}}',
150 'title' => __('Group Size', 'yatra')
151
152 ),
153 array(
154 'icon' => 'fa fa-clock-o',
155 'text' => '{{yatra_tour_meta_tour_duration_days}} days and {{yatra_tour_meta_tour_duration_nights}} nights',
156 'title' => __('Duration', 'yatra')
157
158 ),
159 /*array(
160 'icon' => 'fa fa-calendar-check-o',
161 'text' => '{{yatra_tour_meta_tour_starts_at}}',
162 'title' => __('Starting location', 'yatra')
163
164 ),
165 array(
166 'icon' => 'fa fa-calendar-check-o',
167 'text' => '{{yatra_tour_meta_tour_ends_at}}',
168 'title' => __('Ending location', 'yatra')
169
170 ),*/
171
172 );
173 if (!empty($yatra_tour_meta_tour_country)) {
174
175 $country_string = '';
176
177
178 foreach ($yatra_tour_meta_tour_country as $country_item) {
179
180 $country = yatra_get_countries($country_item);
181
182
183 $country_string .= $country . ', ';
184 }
185 $country_string = trim($country_string, ', ');
186
187 $meta_frontend[] =
188 array(
189 'icon' => 'fa fa-map',
190 'text' => $country_string,
191 'title' => __('Country', 'yatra')
192
193 );
194
195 }
196
197 return apply_filters(
198 'yatra_entry_meta_frontend',
199 $meta_frontend
200 );
201
202 }
203 }
204
205
206 if (!function_exists('yatra_entry_meta_options')) {
207
208 function yatra_entry_meta_options()
209 {
210 $post_id = get_the_id();
211
212 $meta_frontend = yatra_entry_meta_for_frontend_archive($post_id);
213
214 $list = '';
215
216 foreach ($meta_frontend as $value) {
217
218 $icon = isset($value['icon']) ? $value['icon'] : '';
219
220 $text = isset($value['text']) ? $value['text'] : '';
221
222 $title = isset($value['title']) ? $value['title'] : '';
223
224 preg_match_all("~\{\{\s*(.*?)\s*\}\}~", $text, $matches);
225
226 $matches = isset($matches[1]) ? $matches[1] : array();
227
228 foreach ($matches as $match) {
229
230 $text_id = sanitize_text_field($match);
231
232 $text_option = get_post_meta($post_id, $text_id, true);
233
234 $text = str_replace('{{' . $match . '}}', $text_option, $text);
235 }
236
237 $list .= '<li><i class="' . esc_attr($icon) . '"></i>&nbsp;<strong>' . esc_html($title) . ': </strong>' . ($text) . '</li>';
238 }
239 echo '<ul>';
240
241 echo $list;
242
243 echo '</ul>';
244
245 }
246 }
247 if (!function_exists('yatra_tour_tab_configurations')) {
248
249 function yatra_tour_tab_configurations()
250 {
251
252 $tab_config = array(
253 'overview' => array(
254 'label' => __('Overview', 'yatra'),
255 'icon' => 'fa fa-atom',
256 'options' =>
257 array(
258 'overview_label' => array(
259 'name' => 'overview_label',
260 'title' => __('Label Text', 'yatra'),
261 'type' => 'text',
262 'default' => __('Overview', 'yatra'),
263 ),
264 'overview_description' => array(
265 'name' => 'overview_description',
266 'title' => __('Overview Description', 'yatra'),
267 'type' => 'textarea',
268 'editor' => true
269 )
270 ),
271
272 ),
273 'itinerary' => array(
274 'label' => __('Itinerary', 'yatra'),
275 'icon' => 'fa fa-gopuram',
276 'options' =>
277 array(
278 'itinerary_label' => array(
279 'name' => 'itinerary_label',
280 'title' => __('Label', 'yatra'),
281 'type' => 'text',
282 'default' => __('Itinerary', 'yatra'),
283
284 ),
285 'itinerary_repeator' => array(
286 'name' => 'itinerary_repeator',
287 'type' => 'repeator',
288 'options' => array(
289 array(
290 'itinerary_heading' => array(
291 'name' => 'itinerary_heading',
292 'title' => __('Heading', 'yatra'),
293 'type' => 'text',
294 'default' => __('Day {index} ', 'yatra'),
295 'class' => 'mb-repeator-heading-input',
296 ),
297 'itinerary_title' => array(
298 'name' => 'itinerary_title',
299 'title' => __('Title', 'yatra'),
300 'type' => 'text',
301 ),
302 'itinerary_details' => array(
303 'name' => 'itinerary_details',
304 'title' => __('Details', 'yatra'),
305 'type' => 'textarea',
306 'editor' => true
307 )
308 )
309 )
310 )
311
312 )
313 ),
314 'cost_info' => array(
315 'label' => __('Cost Info', 'yatra'),
316 'icon' => 'fa fa-dollar-sign',
317 'options' =>
318 array(
319 'cost_info_label' => array(
320 'name' => 'cost_info_label',
321 'title' => __('Label', 'yatra'),
322 'type' => 'text',
323 'default' => __('Cost Info', 'yatra'),
324 ),
325 'cost_info_price_includes_title' => array(
326 'name' => 'cost_info_price_includes_title',
327 'title' => __('Title', 'yatra'),
328 'type' => 'text',
329 'default' => __('Price includes', 'yatra'),
330 ),
331 'cost_info_price_includes_description' => array(
332 'name' => 'cost_info_price_includes_description',
333 'title' => __('Price include description', 'yatra'),
334 'type' => 'textarea',
335 'description' => __('Type enter to show in new list.', 'yatra'),
336 'editor' => true
337 ),
338 'cost_info_price_excludes_title' => array(
339 'name' => 'cost_info_price_excludes_title',
340 'title' => __('Price excludes title', 'yatra'),
341 'type' => 'text',
342 'default' => __('Price excludes', 'yatra'),
343 ),
344 'cost_info_price_excludes_description' => array(
345 'name' => 'cost_info_price_excludes_description',
346 'title' => __('Price excludes description', 'yatra'),
347 'type' => 'textarea',
348 'description' => __('Type enter to show in new list.', 'yatra'),
349 'editor' => true
350 )
351 ),
352 ),
353 'faq' => array(
354 'label' => __('FAQ', 'yatra'),
355 'icon' => 'fa fa-comment-dots',
356 'options' =>
357 array(
358 'faq_label' => array(
359 'name' => 'faq_label',
360 'title' => __('Label', 'yatra'),
361 'type' => 'text',
362 'default' => __('FAQ', 'yatra'),
363
364 ),
365 'faq_repeator' => array(
366 'name' => 'faq_repeator',
367 'type' => 'repeator',
368 'options' => array(
369 array(
370 'faq_heading' => array(
371 'name' => 'faq_heading',
372 'title' => __('FAQ Heading', 'yatra'),
373 'type' => 'text',
374 'default' => __('FAQ {index} ', 'yatra'),
375 'class' => 'mb-repeator-heading-input'
376 ),
377 'faq_description' => array(
378 'name' => 'faq_description',
379 'title' => __('Description', 'yatra'),
380 'type' => 'textarea',
381 'editor' => true
382 )
383 )
384 )
385 )
386
387 )
388
389 ),
390 'map' => array(
391 'label' => __('Map', 'yatra'),
392 'icon' => 'fa fa-directions',
393 'options' =>
394 array(
395 'map_label' => array(
396 'name' => 'map_label',
397 'title' => __('Label', 'yatra'),
398 'type' => 'text',
399 'default' => __('Map', 'yatra'),
400
401 ),
402 'yatra_tour_meta_map_content' => array(
403 'name' => 'yatra_tour_meta_map_content',
404 'title' => __('Map Content', 'yatra'),
405 'type' => 'textarea',
406 'editor' => true,
407 'allow-html' => true
408 )
409 ),
410 ),
411 'gallery' => array(
412 'label' => __('Gallery', 'yatra'),
413 'icon' => 'fa fa-images',
414 'options' =>
415 array(
416 'gallery_label' => array(
417 'name' => 'gallery_label',
418 'title' => __('Label', 'yatra'),
419 'type' => 'text',
420 'default' => __('Gallery', 'yatra'),
421
422 ),
423 'yatra_tour_meta_gallery' => array(
424 'name' => 'yatra_tour_meta_gallery',
425 'title' => __('Gallery', 'yatra'),
426 'type' => 'gallery',
427 )
428 ),
429 ),
430 );
431 return apply_filters('yatra_tour_tab_configurations', $tab_config);
432 }
433 }
434
435
436 if (!function_exists('yatra_tour_attribute_type_options')) {
437
438 function yatra_tour_attribute_type_options()
439 {
440
441 $tour_attributes = array(
442
443 'text_field' => array(
444 'label' => __('Text Field', 'yatra'),
445 'options' =>
446 array(
447 'content' => array(
448 'name' => 'content',
449 'title' => __('Content', 'yatra'),
450 'placeholder' => __('Default value for text field.', 'yatra'),
451 'description' => __('Default value for text field.', 'yatra'),
452 'type' => 'text',
453
454
455 )
456 ),
457 ),
458 'number_field' => array(
459 'label' => __('Number Field', 'yatra'),
460 'options' =>
461 array(
462
463 'content' => array(
464 'name' => 'content',
465 'title' => __('Default value for number field.', 'yatra'),
466 'placeholder' => __('Default value for number field.', 'yatra'),
467 'description' => __('Default value for number field.', 'yatra'),
468 'type' => 'number',
469 )
470 ),
471 ),
472 'textarea_field' => array(
473 'label' => __('Textarea Field', 'yatra'),
474 'options' =>
475 array(
476
477 'content' => array(
478 'name' => 'content',
479 'title' => __('Default value for textarea field.', 'yatra'),
480 'placeholder' => __('Default value for textarea field.', 'yatra'),
481 'description' => __('Default value for textarea field.', 'yatra'),
482 'type' => 'textarea',
483
484 )
485 ),
486 ),
487 'shortcode_field' => array(
488 'label' => __('Shortcode Field', 'yatra'),
489 'options' =>
490 array(
491 'shortcode' => array(
492 'name' => 'shortcode',
493 'title' => __('Shortcode', 'yatra'),
494 'placeholder' => __('Default value for text field.', 'yatra'),
495 'description' => __('Default value for text field.', 'yatra'),
496 'type' => 'shortcode',
497 'wrap_class' => 'yatra-left',
498
499
500 )
501 ),
502 ),
503 /* 'dropdown_field' => array(
504 'label' => __('Dropdown Field', 'yatra'),
505 'options' =>
506 array(
507 'content' => array(
508 'name' => 'content',
509 'title' => __('Default value for select(drop-down) field. Enter drop-down values separated by commas.', 'yatra'),
510 'placeholder' => __('Default value for select(drop-down) field. Enter drop-down values separated by commas.', 'yatra'),
511 'description' => __('Default value for select(drop-down) field. Enter drop-down values separated by commas.', 'yatra'),
512 'type' => 'textarea',
513
514
515
516 )
517 ),
518 )*/
519 );
520 return apply_filters('yatra_tour_attribute_type_options', $tour_attributes);
521 }
522 }
523
524
525 if (!function_exists('yatra_tour_attributes_list')) {
526 function yatra_tour_attributes_list()
527 {
528 $terms = get_terms(array(
529 'taxonomy' => 'attributes',
530 'hide_empty' => false
531
532 ));
533
534 $fields = array();
535
536 $number_of_tour_attributes = apply_filters('number_of_tour_attributes', 5);
537
538 foreach ($terms as $term_key => $term_value) {
539 if (isset($term_value->term_id)) {
540 $fields[$term_value->term_id] = $term_value->name;
541 if (count($fields) === $number_of_tour_attributes && $number_of_tour_attributes !== -1) {
542 break;
543 }
544 }
545 }
546 return $fields;
547
548 }
549 }
550 if (!function_exists('yatra_tour_attributes')) {
551 function yatra_tour_attributes()
552 {
553 $tour_attributes = array(
554 array(
555 'name' => 'tour_attributes',
556 'title' => sprintf(__('Tour Attributes', 'yatra')),
557 'type' => 'select',
558 'options' => yatra_tour_attributes_list(),
559 'wrap_class' => 'yatra-left',
560 ),
561 array(
562 'name' => 'add_tour_attribute',
563 'type' => 'button',
564 'default' => sprintf(__('Add New', 'yatra')),
565 'wrap_class' => 'yatra-right'
566
567 )
568 );
569 return apply_filters('yatra_tour_attributes', $tour_attributes);
570 }
571 }
572
573
574 if (!function_exists('yatra_tour_general_configurations')) {
575
576 function yatra_tour_general_configurations()
577 {
578 $currency = get_option('yatra_currency');
579
580 $currency_symbols = yatra_get_currency_symbols($currency);
581
582 $countries = yatra_get_countries();
583
584 $tour_options = array(
585 'yatra_tour_meta_price_per' => array(
586 'name' => 'yatra_tour_meta_price_per',
587 'title' => __('Price Per', 'yatra'),
588 'type' => 'select',
589 'wrap_class' => 'yatra-left',
590 'row_start' => true,
591 'options' => array(
592 'person' => __('Person', 'yatra'),
593 'group' => __('Group', 'yatra')
594 ),
595 ), 'yatra_tour_meta_group_size' => array(
596 'name' => 'yatra_tour_meta_group_size',
597 'title' => __('Group Size', 'yatra'),
598 'type' => 'number',
599 'wrap_class' => 'yatra-right',
600 'extra_attributes' => array(
601 'placeholder' => __('Group Size', 'yatra'),
602 ),
603 'row_end' => true,
604 ),
605 'yatra_tour_meta_regular_price' => array(
606 'name' => 'yatra_tour_meta_regular_price',
607 'title' => sprintf(__('Tour Price- Regular (%s)', 'yatra'), $currency_symbols),
608 'type' => 'number',
609 'wrap_class' => 'yatra-left',
610 'extra_attributes' => array(
611 'placeholder' => sprintf(__('Tour Price - Regular (%s)', 'yatra'), $currency_symbols),
612 ),
613 'row_start' => true,
614 ),
615 'yatra_tour_meta_sales_price' => array(
616 'name' => 'yatra_tour_meta_sales_price',
617 'title' => sprintf(__('Tour Price- Sales Price (%s)', 'yatra'), $currency_symbols),
618 'type' => 'number',
619 'wrap_class' => 'yatra-right',
620 'extra_attributes' => array(
621 'placeholder' => sprintf(__('Tour Price - Sales Price (%s). Leave it empty if you do not want to show sales price.', 'yatra'), $currency_symbols),
622 ),
623 'row_end' => true,
624 ),
625 'yatra_tour_meta_tour_duration_days' => array(
626 'name' => 'yatra_tour_meta_tour_duration_days',
627 'title' => esc_html__('Tour Duration Days', 'yatra'),
628 'type' => 'number',
629 'wrap_class' => 'yatra-left',
630 'extra_attributes' => array(
631 'placeholder' => __('Number of days', 'yatra'),
632 ),
633 'row_start' => true,
634
635 ),
636 'yatra_tour_meta_tour_duration_nights' => array(
637 'name' => 'yatra_tour_meta_tour_duration_nights',
638 'title' => esc_html__('Tour Duration Nights', 'yatra'),
639 'type' => 'number',
640 'wrap_class' => 'yatra-right',
641 'extra_attributes' => array(
642 'placeholder' => __('Number of nights', 'yatra'),
643 ),
644 'row_end' => true,
645
646 ),
647 'yatra_tour_meta_tour_country' => array(
648 'name' => 'yatra_tour_meta_tour_country',
649 'title' => esc_html__('Country', 'yatra'),
650 'type' => 'select',
651 'wrap_class' => 'yatra-left',
652 'extra_attributes' => array(
653 'placeholder' => __('Country', 'yatra'),
654 ),
655 'options' => $countries,
656 'default' => 'NP',
657 'is_multiple' => true,
658 'select2' => true,
659 'row_start' => true,
660
661 ),
662 'yatra_tour_meta_tour_tabs_ordering' => array(
663 'name' => 'yatra_tour_meta_tour_tabs_ordering',
664 'type' => 'hidden',
665
666 ),
667 );
668 return apply_filters('yatra_tour_general_configurations', $tour_options);
669 }
670 }
671
672
673 if (!function_exists('yatra_frontend_tabs_config')) {
674
675 function yatra_frontend_tabs_config()
676 {
677
678 $post_id = get_the_ID();
679
680 $yatra_tour_meta_tour_tabs_ordering = get_post_meta($post_id, 'yatra_tour_meta_tour_tabs_ordering', true);
681
682 $yatra_tour_meta_tour_tabs_ordering_array = explode(',', $yatra_tour_meta_tour_tabs_ordering);
683
684 $configs = yatra_tour_tab_configurations();
685
686 $config_array_keys = array_keys($configs);
687
688 $array_diff = array_diff($config_array_keys, $yatra_tour_meta_tour_tabs_ordering_array);
689
690 $final_ordered_config_keys = $yatra_tour_meta_tour_tabs_ordering_array;
691
692 if (count($array_diff) > 0) {
693
694 $final_ordered_config_keys = array_merge($yatra_tour_meta_tour_tabs_ordering_array, $array_diff);
695 }
696
697 $frontend_tabs_config = array();
698
699 $active_tab_config = '';
700
701 foreach ($final_ordered_config_keys as $config) {
702
703 if (isset($configs[$config])) {
704
705 $setting = $configs[$config];
706
707 $label = get_post_meta($post_id, $config . '_label', true);
708
709 $label = empty($label) ? $setting['label'] : $label;
710
711 $frontend_tabs_config [$config] = $label;
712
713 }
714 }
715
716 return apply_filters('frontend_tabs_configurations', $frontend_tabs_config);
717 }
718 }
719
720
721 if (!function_exists('yatra_frontend_tabs')) {
722
723 function yatra_frontend_tabs()
724 {
725 global $post;
726
727 $frontend_tabs_config = yatra_frontend_tabs_config();
728 $yatra_tour_tab_configurations = yatra_tour_tab_configurations();
729
730 ?>
731 <div class="yatra-tabs">
732
733 <ul class="yatra-tab-wrap">
734 <?php foreach ($frontend_tabs_config as $tab_key => $tab) { ?>
735 <li class="item"><a
736 href="#<?php echo esc_attr($tab_key); ?>"><?php if (isset($yatra_tour_tab_configurations[$tab_key]) && isset($yatra_tour_tab_configurations[$tab_key]['icon'])) {
737 echo !empty($yatra_tour_tab_configurations[$tab_key]['icon']) ? '<span class="' . esc_attr($yatra_tour_tab_configurations[$tab_key]['icon']) . '"></span>' : '';
738 }
739 echo esc_html($tab); ?></a></li>
740 <?php } ?>
741 </ul>
742 <?php
743 $loop_index = 0;
744 foreach ($frontend_tabs_config as $tab_content_key => $tab_content) { ?>
745 <section id="<?php echo esc_attr($tab_content_key); ?>"
746 class="yatra-tab-content" <?php if ($loop_index > 0) { ?> aria-hidden="true" <?php } ?>>
747 <div class="tab-inner">
748 <?php
749 do_action('yatra_frontend_tab_content_' . $tab_content_key, $tab_content, $post)
750 ?>
751 </div>
752 </section>
753 <?php
754 $loop_index++;
755 } ?>
756
757 </div>
758 <?php
759 }
760 }
761 if (!function_exists('yatra_frontend_options')) {
762 function yatra_frontend_options()
763 {
764 $post_id = get_the_ID();
765 $yatra_tour_meta_price_per = get_post_meta($post_id, 'yatra_tour_meta_price_per', true);
766 $yatra_tour_meta_group_size = get_post_meta($post_id, 'yatra_tour_meta_group_size', true);
767 $yatra_tour_meta_regular_price = get_post_meta($post_id, 'yatra_tour_meta_regular_price', true);
768 $yatra_tour_meta_sales_price = get_post_meta($post_id, 'yatra_tour_meta_sales_price', true);
769 $yatra_tour_meta_tour_duration_days = get_post_meta($post_id, 'yatra_tour_meta_tour_duration_days', true);
770 $yatra_tour_meta_tour_duration_nights = get_post_meta($post_id, 'yatra_tour_meta_tour_duration_nights', true);
771 $yatra_tour_meta_tour_country = get_post_meta($post_id, 'yatra_tour_meta_tour_country', true);
772
773
774 $currency = get_option('yatra_currency');
775
776 $currency_symbol = yatra_get_currency_symbols($currency);
777
778 if (!empty($yatra_tour_meta_tour_country)) {
779
780 $country_string = '';
781
782
783 foreach ($yatra_tour_meta_tour_country as $country_item) {
784
785 $country = yatra_get_countries($country_item);
786
787
788 $country_string .= $country . ', ';
789 }
790 $country_string = trim($country_string, ', ');
791
792 $meta_frontend[] =
793 array(
794 'icon' => 'fa fa-map',
795 'text' => $country_string,
796 'title' => __('Country', 'yatra')
797
798 );
799
800 }
801 $price_string = $currency_symbol . absint($yatra_tour_meta_regular_price);
802 if ($yatra_tour_meta_sales_price > 0) {
803
804 $price_string = '<del>' . $price_string . '</del> &nbsp;' . $currency_symbol . $yatra_tour_meta_sales_price;
805 }
806 ?>
807 <h3><?php echo __('Options', 'yatra') ?></h3>
808 <table>
809 <tr>
810 <th><?php echo __('Price per', 'yatra') ?></th>
811 <td><?php echo esc_html(ucwords($yatra_tour_meta_price_per)) ?></td>
812 </tr>
813 <tr>
814 <th><?php echo __('Group Size', 'yatra') ?></th>
815 <td><?php echo absint($yatra_tour_meta_group_size) ?></td>
816 </tr>
817 <tr>
818 <th><?php echo __('Price', 'yatra') ?></th>
819 <td><?php echo $price_string; ?></td>
820 </tr>
821 <tr>
822 <th><?php echo __('Tour Duration', 'yatra') ?></th>
823 <td><?php echo absint($yatra_tour_meta_tour_duration_days); ?>
824 Days <?php echo absint($yatra_tour_meta_tour_duration_nights) ?> Nights
825 </td>
826 </tr>
827 <tr>
828 <th><?php echo __('Country', 'yatra') ?></th>
829 <td><?php echo esc_html($country_string); ?></td>
830 </tr>
831 </table>
832
833 <?php
834
835 $tour_meta_custom_attributes = get_post_meta($post_id, 'tour_meta_custom_attributes', true);
836 if (count($tour_meta_custom_attributes) > 0) {
837 echo '<h3>' . __('Attributes', 'yatra') . '</h3>';
838 $yatra_tour_attribute_type_options = yatra_tour_attribute_type_options();
839 ?>
840 <table>
841 <?php foreach ($tour_meta_custom_attributes as $term_id => $content) {
842 $term = get_term($term_id);
843 $field_key = get_term_meta($term_id, 'attribute_field_type', true);
844 $field = isset($yatra_tour_attribute_type_options[$field_key]) ? $yatra_tour_attribute_type_options[$field_key] : array();
845 $field_option = isset($field['options']) ? $field['options'] : array();
846 if (isset($term->name)) {
847 ?>
848 <tr>
849 <th><?php echo esc_html($term->name) ?></th>
850 <td><?php
851
852 foreach ($content as $content_key => $content_value) {
853
854 $type = isset($field_option[$content_key]['type']) ? $field_option[$content_key]['type'] : '';
855
856 $value = '';
857
858 if (count($field_option) > 0) {
859
860 switch ($type) {
861 case "text":
862 $value = esc_html($content_value);
863 break;
864 case "textarea":
865 $value = esc_html($content_value);
866 break;
867
868 case "number":
869 $value = absint($content_value);
870 break;
871 case "shortcode":
872 $value = do_shortcode($content_value);
873 break;
874
875
876 }
877
878 echo '<p>' . ($value) . '</p>';
879 }
880 }
881 ?></td>
882 </tr>
883
884 <?php
885 }
886 } ?>
887 </table>
888
889 <?php
890 }
891
892 }
893 }