getBySlug($trip_slug); if (!$trip_data) { $this->set404(); return false; } // Set up global trip object for template compatibility global $trip; $trip = $trip_data; // Configure $wp_query + virtual WP_Post so FSE block themes resolve the // singular template (not 404.html) and render the site header normally. $this->setupPageEnvironment('singular', [ 'title' => (string) ($trip->title ?? $trip->name ?? ''), 'object_id' => (int) ($trip->id ?? 0), 'post_type' => 'page', 'post_name' => $trip_slug, ]); // Set up query vars for backward compatibility $this->setQueryVars([ 'yatra_trip_id' => $trip->id, 'yatra_trip' => $trip, 'yatra_trip_slug' => $trip_slug, 'yatra_page' => $route_data['base'] ?? SettingsService::getTripBase(), ]); return $this->selectTemplate('single-trip', new TripAssetManager(), 'trip'); } }