| @@ -32,10 +32,15 @@ | ||
| 32 | 32 | if (!empty($route_data['trip']) && is_string($route_data['trip'])) { |
| 33 | 33 | $_GET['trip'] = sanitize_title($route_data['trip']); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - // Prevent 404 handling | |
| 37 | - $this->prevent404(); | |
| 36 | + // Configure $wp_query + virtual WP_Post so FSE block themes don't fall back | |
| 37 | + // to 404.html — see BasePageHandler::setupPageEnvironment(). | |
| 38 | + $this->setupPageEnvironment('singular', [ | |
| 39 | + 'title' => __('Booking', 'yatra'), | |
| 40 | + 'post_type' => 'page', | |
| 41 | + 'post_name' => $base, | |
| 42 | + ]); | |
| 38 | 43 | |
| 39 | 44 | // Set up query vars for backward compatibility |
| 40 | 45 | $this->setQueryVars([ |
| 41 | 46 | 'yatra_page' => $base, |
| @@ -260,18 +265,7 @@ | ||
| 260 | 265 | if ($booking !== null) { |
| 261 | 266 | $this->setGlobal('booking', $booking); |
| 262 | 267 | } |
| 263 | 268 | |
| 264 | - // Load the booking page template | |
| 265 | - $template_path = YATRA_PLUGIN_PATH . 'templates/booking.php'; | |
| 266 | - | |
| 267 | - if (!file_exists($template_path)) { | |
| 268 | - $this->logError("Booking template not found: {$template_path}"); | |
| 269 | - return false; | |
| 270 | - } | |
| 271 | - | |
| 272 | - include $template_path; | |
| 273 | - $this->exit(); | |
| 274 | - | |
| 275 | - return true; | |
| 269 | + return $this->selectTemplate('booking', null, 'booking'); | |
| 276 | 270 | } |
| 277 | 271 | } |