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 | app/Shortcodes/TripCategoryShortcode.php +19 -2 3.0.4 → 3.0.16 View file →
@@ -22,9 +22,13 @@
22 22 'show_description' => 'yes',
23 23 'show_image' => 'yes',
24 24 'show_pagination' => 'yes',
25 25 'category' => '', // Classification IDs, comma-separated
26 - 'hide_empty' => 'yes',
26 + // hide_empty defaults to 'no' to preserve the historical
27 + // behavior (show every category, even ones with zero
28 + // trips). Operators that prefer the empty-archive defense
29 + // opt in with hide_empty="yes".
30 + 'hide_empty' => 'no',
27 31 'featured_only' => 'no',
28 32 'title' => 'Trip Categories',
29 33 ]);
30 34 }
@@ -219,11 +223,24 @@
219 223 'best_season' => $best_season,
220 224 ];
221 225 }
222 226
227 + // Filter out trip categories that have no published trips.
228 + //
229 + // See ActivityShortcode for the full rationale — the
230 + // prior implementation only filtered on term-metadata
231 + // emptiness (which never actually fires), so empty
232 + // categories were rendered with "0 trips" badges and
233 + // broken archive links. We now drop any category whose
234 + // trip_count (computed above from
235 + // TripClassificationsTable JOIN TripsTable WHERE
236 + // status=publish) is zero, plus the original sanity
237 + // check on name/slug.
223 238 if (($atts['hide_empty'] ?? 'yes') === 'yes') {
224 239 $categories = array_filter($categories, static function ($row) {
225 - return !empty($row['term']->name) && !empty($row['term']->slug);
240 + return (int) ($row['trip_count'] ?? 0) > 0
241 + && !empty($row['term']->name)
242 + && !empty($row['term']->slug);
226 243 });
227 244 }
228 245
229 246 if (($atts['featured_only'] ?? 'no') === 'yes') {