PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.13
Yatra – Travel Booking & Tour Operator Software v3.0.13
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 / examples / individual-filters-example.php

individual-filters-example.php in Yatra – Travel Booking & Tour Operator Software 3.0.13, at templates/examples/individual-filters-example.php

115 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Example: Using Individual Filter Components
4 *
5 * This file demonstrates how to use the new FilterService and helper functions
6 * to create custom filter layouts and individual filter sections.
7 */
8
9 // Include the filter helpers
10 require_once plugin_dir_path(__FILE__) . '../../includes/filter-helpers.php';
11
12 // Example active filters (normally from URL parameters)
13 $active_filters = [
14 'price_min' => 200,
15 'price_max' => 1000,
16 'categories' => [1, 3],
17 'difficulty' => [2],
18 'rating' => [4, 5]
19 ];
20
21 ?>
22
23 <!DOCTYPE html>
24 <html>
25 <head>
26 <title><?php esc_html_e('Individual Filter Components Example', 'yatra'); ?></title>
27 <link rel="stylesheet" href="../../assets/css/listing.css">
28 </head>
29 <body>
30
31 <h1><?php esc_html_e('Individual Filter Components Examples', 'yatra'); ?></h1>
32
33 <!-- Example 1: Single Price Filter -->
34 <section>
35 <h2><?php esc_html_e('Example 1: Price Filter Only', 'yatra'); ?></h2>
36 <div class="filter-container">
37 <?php echo yatra_render_price_filter($active_filters); ?>
38 </div>
39 </section>
40
41 <!-- Example 2: Categories and Destinations Only -->
42 <section>
43 <h2><?php esc_html_e('Example 2: Categories + Destinations', 'yatra'); ?></h2>
44 <div class="filter-container">
45 <?php
46 echo yatra_render_categories_filter($active_filters);
47 echo yatra_render_destinations_filter($active_filters);
48 ?>
49 </div>
50 </section>
51
52 <!-- Example 3: Custom Filter Combination -->
53 <section>
54 <h2><?php esc_html_e('Example 3: Custom Filter Set', 'yatra'); ?></h2>
55 <div class="filter-container">
56 <?php
57 echo yatra_render_custom_filters([
58 'price_range',
59 'rating',
60 'difficulty'
61 ], $active_filters);
62 ?>
63 </div>
64 </section>
65
66 <!-- Example 4: Complete Sidebar with Custom Options -->
67 <section>
68 <h2><?php esc_html_e('Example 4: Complete Sidebar (Custom Configuration)', 'yatra'); ?></h2>
69 <div class="filter-container">
70 <?php
71 echo yatra_render_filter_sidebar($active_filters, [
72 'enabled_filters' => ['price_range', 'categories', 'rating'],
73 'min_price' => 50,
74 'max_price' => 2000
75 ]);
76 ?>
77 </div>
78 </section>
79
80 <!-- Example 5: Horizontal Filter Layout -->
81 <section>
82 <h2><?php esc_html_e('Example 5: Horizontal Filter Layout', 'yatra'); ?></h2>
83 <div style="display: flex; gap: 20px; flex-wrap: wrap;">
84 <div style="flex: 1; min-width: 250px;">
85 <?php echo yatra_render_price_filter($active_filters); ?>
86 </div>
87 <div style="flex: 1; min-width: 250px;">
88 <?php echo yatra_render_categories_filter($active_filters); ?>
89 </div>
90 <div style="flex: 1; min-width: 250px;">
91 <?php echo yatra_render_rating_filter($active_filters); ?>
92 </div>
93 </div>
94 </section>
95
96 <!-- Example 6: Using FilterService Directly -->
97 <section>
98 <h2><?php esc_html_e('Example 6: Using FilterService Directly', 'yatra'); ?></h2>
99 <div class="filter-container">
100 <?php
101 use Yatra\Services\FilterService;
102
103 $filterService = new FilterService();
104
105 // Render individual components
106 echo $filterService->renderDifficultyFilter($active_filters);
107 echo $filterService->renderActivitiesFilter($active_filters);
108 ?>
109 </div>
110 </section>
111
112 <script src="../public/js/listing-filters.js"></script>
113 </body>
114 </html>
115