How themefic-team/tourfic works
1. Tourfic is a WordPress plugin, so the runtime boundary is WordPress/PHP first, with browser-side CSS/JS shipped as plugin assets. The main entrypoints are tourfic.php, autoloader.php, and the classes under inc/.
2. The core domain is built around multiple travel product types: hotel, tour, apartment, car rental, and room. Each type has its own CPT, pricing, availability, and taxonomies in inc/Classes/* and inc/Admin/TF_Options/taxonomies/*.
3. Content editing and site setup live in the admin layer. inc/Admin/TF_Options provides the plugin’s metabox/settings framework, while tf-*-metabox.php, setup wizard, demo importer, notices, dashboard widgets, and menu/icon settings define how travel inventory is configured in wp-admin.
4. Frontend rendering is template-driven. The templates/ tree contains archive/single/search/wishlist pages, and inc/App/Templates/Components/* breaks those pages into reusable UI sections such as gallery, booking form, map, reviews, amenities, itinerary, and related content.
5. Data flow on the frontend is mostly: WordPress content + custom fields + availability/pricing logic -> template component -> rendered archive/single/search page. The repository keeps the presentation layer separate from the domain logic, so template files stay thin and domain classes compute the bookable state.
6. Search and discovery are a major subsystem. Shortcodes in inc/App/Shortcodes and widgets in inc/App/Widgets expose listings, filters, destination/brand/location blocks, review sliders, wishlist, and search forms to both native WordPress pages and page builders.
7. Booking, enquiry, and email handling form the transactional layer. Availability/pricing classes for each product type feed booking forms and backend booking screens, while inc/Admin/Booking_Details, inc/Admin/Backend_Booking, inc/Admin/Enquiry, and inc/Admin/Emails manage booking records, admin-side details, enquiry capture, and booking notifications/confirmation/cancellation emails.
8. There is a dedicated REST API boundary in inc/Classes/REST_API. Routes for bookings, enquiries, users, and each product type suggest the plugin supports JavaScript-driven interactions and external integrations beyond normal page requests.
9. WooCommerce is an optional commerce integration layer. inc/Classes/Woocommerce and inc/functions/woocommerce/* adapt hotel/car/tour/apartment bookings into WooCommerce products/orders and handle tax/VAT concerns.
10. Page-builder and template-builder support is a distinct extension layer. Elementor widgets live under inc/App/Widgets/Elementor, and Bricks/Elementor demo template JSON files under assets/demo/ show that listing and single-page layouts can be imported or composed outside the core PHP templates.
11. Static assets are split by admin vs app vs product type. The source styles live in sass/, compiled CSS/JS is under assets/, and frontend dependencies include libraries such as Leaflet, Flatpickr, Select2, Slick, Chart.js, Fancybox, and validation/notification utilities.
12. The repository also includes security regression tests in tests/security, indicating the plugin has been hardened around booking counts, REST authorization, SQL injection, and review/enquiry surfaces. Internationalization is supported via lang/ and wpml-config.xml.
13. From an architecture diagram perspective, the key boundaries are: WordPress admin configuration, domain/CPT and availability logic, frontend templates/widgets/shortcodes, transactional booking/enquiry/email flows, REST API integrations, and optional WooCommerce/page-builder integrations.
Main entry points: Classes Core Classes · templates Templates · REST_API REST API · Woocommerce WooCommerce
Components 24
Plugin Core
Plugin bootstrap, shared core classes, and runtime wiring.
- tourfic.php · Main plugin entrypoint that starts the runtime.
tourfic.php - Autoloader · Loads plugin classes and dependencies.
autoloader.php - Core Classes · Shared core services and plugin lifecycle wiring.
inc/Classes - Helpers · Common helper functions and support traits.
inc/functions.php
Admin
WordPress admin configuration, booking management, notices, and setup.
- Options Framework · Metabox, settings, shortcode, and taxonomy field framework.
inc/Admin/TF_Options - Setup & Import · Setup wizard, demo importer, duplicator, and notices.
inc/Admin/TF_Setup_Wizard.php - Bookings · Backend booking screens and booking detail views.
inc/Admin/Backend_Booking - Enquiries · Admin-side enquiry capture and handling.
inc/Admin/Enquiry - Emails · Booking notification, confirmation, and cancellation email flows.
inc/Admin/Emails/TF_Handle_Emails.php
Domain Logic
Product-type models, availability, pricing, and REST boundaries.
- Hotels · Hotel CPT, pricing, and availability logic.
inc/Classes/Hotel - Tours · Tour CPT, pricing, and itinerary/booking logic.
inc/Classes/Tour - Apartments · Apartment CPT, pricing, and availability logic.
inc/Classes/Apartment - Car Rentals · Car rental CPT, pricing, and availability logic.
inc/Classes/Car_Rental - Rooms · Room CPT and pricing/availability support.
inc/Classes/Room - REST API · Routes for bookings, enquiries, users, and product types.
inc/Classes/REST_API
Frontend
Templates, shortcodes, widgets, and reusable UI components.
- Shortcodes · Listing, search, wishlist, review, and filter shortcodes.
inc/App/Shortcodes - Widgets · WordPress widgets and Elementor widgets for listings and search.
inc/App/Widgets - UI Components · Reusable archive and single-page components for each product.
inc/App/Templates/Components - Templates · Archive, single, search, taxonomy, and wishlist page templates.
templates - Wishlist & Reviews · Wishlist and review-related frontend behavior.
inc/App/Wishlist.php
Integrations
Optional commerce, builder, asset, and localization layers.
- WooCommerce · Optional product/order and tax/VAT integration.
inc/Classes/Woocommerce - Builder Support · Elementor/Bricks template-builder support and demo layouts.
inc/App/Templates/Template_Builder.php - Assets · Admin and frontend compiled CSS/JS plus vendor libraries.
assets - i18n · Language packs and WPML configuration.
lang
Connections 36
- tourfic.php → Autoloader: boots · Main plugin file initializes loading.
- tourfic.php → Core Classes: starts · Registers the core runtime services.
- Autoloader → Core Classes: loads · Autoloads plugin classes.
- Core Classes → Options Framework: configures · Core uses the options framework for metaboxes and settings.
- Core Classes → Setup & Import: registers · Connects onboarding and admin notices.
- Core Classes → Bookings: manages · Wires backend booking management.
- Core Classes → Enquiries: captures · Connects enquiry handling.
- Core Classes → Emails: sends · Routes booking events into email notifications.
- Core Classes → Hotels: defines · Hotel subsystem domain logic.
- Core Classes → Tours: defines · Tour subsystem domain logic.
- Core Classes → Apartments: defines · Apartment subsystem domain logic.
- Core Classes → Car Rentals: defines · Car rental subsystem domain logic.
- Core Classes → Rooms: defines · Room subsystem domain logic.
- Hotels → REST API: exposes · Hotel routes are available through the API boundary.
- Tours → REST API: exposes · Tour routes are available through the API boundary.
- Apartments → REST API: exposes · Apartment routes are available through the API boundary.
- Car Rentals → REST API: exposes · Car rental routes are available through the API boundary.
- Rooms → REST API: exposes · Room routes are available through the API boundary.
- Hotels → Templates: renders · Hotel pages are rendered by template files.
- Tours → Templates: renders · Tour pages are rendered by template files.
- Apartments → Templates: renders · Apartment pages are rendered by template files.
- Car Rentals → Templates: renders · Car rental pages are rendered by template files.
- Rooms → Templates: renders · Room pages are rendered by template files.
- Templates → UI Components: composes · Top-level templates assemble reusable UI components.
- Shortcodes → Templates: feeds · Shortcodes render listing and search views.
- Widgets → Shortcodes: reuses · Widget implementations expose the same discovery surfaces.
- Widgets → UI Components: reuses · Widgets share UI building blocks.
- Wishlist & Reviews → Shortcodes: supports · Wishlist and review features are surfaced in content blocks.
- WooCommerce → Hotels: adapts · Commerce integration for hotel bookings.
- WooCommerce → Tours: adapts · Commerce integration for tour bookings.
- WooCommerce → Apartments: adapts · Commerce integration for apartment bookings.
- WooCommerce → Car Rentals: adapts · Commerce integration for car bookings.
- Builder Support → Templates: extends · Page-builder layouts can override or supplement templates.
- Builder Support → Assets: ships · Builder-related scripts and styles are bundled as assets.
- Core Classes → Assets: enqueues · Core runtime enqueues admin and app assets.
- i18n → Templates: localizes · Template strings and UI text are translated.