# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

This is a **WordPress travel/tour booking site** (`staging.merrymorocco.com`). There is no build system — all customizations are made via direct PHP/CSS/JS file edits or through the WordPress admin UI. No npm, composer, webpack, or Makefile is present.

## Key Configuration

- **wp-config.php**: Database credentials, `WP_CACHE = true` (LiteSpeed), `WP_DEBUG = false`
- **Database**: `merroetv_refonte12`, table prefix `wpxw_`
- **Caching**: LiteSpeed Cache plugin + `.htaccess` directives — after editing theme files, the LiteSpeed cache may need to be flushed from the WP admin panel (LiteSpeed > Purge All)

## Architecture

### Theme Layer
- **`wp-content/themes/triply/`** — Parent theme (Pavothemes Triply v2.4.4). Do not edit directly; use the child theme instead.
- **`wp-content/themes/triply-child/`** — Active child theme. All custom overrides go here. Follows standard WordPress child theme conventions (`functions.php` enqueues parent styles, template files here override parent).

Key parent theme files to understand before overriding:
- `inc/class-main.php` — Asset enqueuing, theme setup, sidebar/widget registration
- `inc/class-customize.php` — Theme Customizer API options
- `inc/template-hooks.php` — All action/filter hook placements
- `inc/template-functions.php` — Template utility functions (breadcrumbs, comments, etc.)
- `inc/functions.php` — Plugin detection helpers (`triply_is_elementor_activated()`, `triply_is_babe_activated()`, etc.)
- `inc/elementor/` — Custom Elementor widget registration and widget classes
- `inc/booking/` — BA Book Everything plugin integration (tour display, booking hooks)

### Booking System
The tour booking functionality is powered by the **BA Book Everything** plugin (`wp-content/plugins/ba-book-everything/`). It registers:
- Custom post type `to_book` (tours/bookable products)
- Custom post type `service`
- Custom taxonomies for tour categories, locations, features, amenities
- CMB2 metaboxes for tour configuration

The Triply theme's `inc/booking/` directory contains hooks and template overrides that bridge BA Booking with the theme display layer.

### Page Building
Pages are built with **Elementor Pro**. Most frontend layouts are stored as Elementor JSON in the database (not in template files). The theme registers custom Elementor widgets in `inc/elementor/` that wrap BA Booking and theme-specific functionality.

### Plugins to Be Aware Of
| Plugin | Purpose |
|--------|---------|
| `ba-book-everything` | Core tour/booking engine |
| `elementor` + `elementor-pro` | Page builder — most page layouts live here |
| `litespeed-cache` | Full-pageefefe caching (must flush after PHP/CSS changes) |
| `code-snippets` | Custom PHP snippets stored in DB (check here before looking for hook overrides in files) |
| `header-footer-code-manager` | Injects code into `<head>`, body start/end (check here for any injected scripts/styles) |
| `gtranslate` | Multi-language translation layer |
| `wordpress-seo` + `seo-by-rank-math` | Both SEO plugins are installed — potential conflicts to watch for |

### URL / Rewrite Rules
Pretty permalinks are active. `.htaccess` also strips tracking query parameters (`fbclid`, `gclid`, `utm_*`, `_ga`) before they reach WordPress, and blocks direct access to `wp-includes` and `wp-admin/includes`.

## Where Customizations Live

When investigating unexpected behavior, check in this order:
1. `wp-content/themes/triply-child/` — File-based template/function overrides
2. **Code Snippets plugin** — PHP hooks stored in the database
3. **Header Footer Code Manager plugin** — Injected scripts/styles
4. **Elementor** page/section settings — Layout and widget configuration
5. `wp-content/themes/triply/` — Parent theme defaults

## Caching Gotcha

LiteSpeed caching is aggressive. After editing any PHP, CSS, or JS file, purge the LiteSpeed cache (WP Admin → LiteSpeed Cache → Purge All) or changes will not be visible on the frontend. The `WP_CACHE` constant is enabled in `wp-config.php`.
