← Back
Editing: CLAUDE.md
# OQILA WP — Copilot Instructions ## Project Overview This is **OQILA WP**: a customized WordPress base maintained by OQILA Company for internal agency use. It serves as the starting point for all client projects. It is **not a vanilla WordPress install** — do not treat it as one. Do not recommend reverting, replacing, or overriding OQILA WP customizations with vanilla WordPress equivalents. ## Architecture & Key Customizations ### Configuration Split WordPress config is split into two files: - `wp-config.php` — committed, contains WordPress keys/salts and includes `wp-config-local.php` - `wp-config-local.php` — **not committed** (gitignored), contains DB credentials and `WP_HOME`/`WP_SITEURL` - `wp-config-local.php.dist` — committed template; copy and fill in when setting up a new project When generating setup instructions, always reference the `.dist` copy pattern. ### index.php Customizations `index.php` has two additions on top of the WordPress default: 1. **Debug mode switch**: If a file named `DEBUG` exists in the project root, PHP errors are displayed and `WP_DEBUG`, `WP_DEBUG_LOG`, `WP_DEBUG_DISPLAY` are all enabled. To enable debug mode, create an empty `DEBUG` file. To disable it, delete the file. 2. **UTM & referrer tracking**: On first visit (per session), `utm_source`, `utm_medium`, `utm_campaign` and external referrer domain are stored in PHP session under keys prefixed `oqila_` (e.g. `$_SESSION['oqila_utm_source']`). When WordPress core updates overwrite `index.php`, restore it from `./install/data/index.php`. ### Default Plugins (Pre-installed) All projects start with these plugins — treat them as available and active: | Plugin | Purpose | |---|---| | `advanced-custom-fields` | ACF — primary content fields engine | | `custom-post-type-ui` | Register custom post types and taxonomies | | `polylang` | Multilingual support | | `classic-editor` | Replaces Gutenberg with classic editor | | `admin-menu-editor` | Customise WP admin menu | | `limit-login-attempts-reloaded` | Brute-force login protection | | `wps-hide-login` | Changes login URL; default login slug is `/boshqaruv` | | `stops-core-theme-and-plugin-updates` | Prevents auto-update prompts | | `wp-fastest-cache` | Page caching | | `webp-converter-for-media` | Automatic WebP conversion | | `regenerate-thumbnails` | Regenerate image sizes after changes | | `wordpress-seo` (Yoast) | SEO meta management | When suggesting plugins, prefer solutions using already-installed plugins before recommending new ones. ### oqila-mini Theme The base theme is `wp-content/themes/oqila-mini`. It is the **only theme** used in all projects. Never suggest switching to or installing another theme as a base. **Theme conventions:** - Minimal theme — no Gutenberg/block editor support; uses the classic editor - No script or style enqueues like `get_stylesheet_uri()` - CSS and JS assets live in `assets/` - `style.css` is the main stylesheet (empty in base; filled per project) - `wpautop` is removed for both `the_content` and `the_excerpt` — do not re-add it - JPEG quality is forced to 100% — do not add compression - Pre-registered image sizes: `catalog-category` (220px wide), `catalog-product-list` (350px wide) **Built-in helper functions** (available in all templates without `require`): - `get_contact_field($field)` — returns ACF field from the contacts page (post ID 49) - `get_menu($menu_name)` — returns a two-level nav menu tree (items with `children` array) - `get_root_categories($taxonomy, $with_children, $only_current_language)` — returns root taxonomy terms filtered by current Polylang language - `email_order_get_lang()` — returns current language for email templates (`uz`, `ru`, or `en`) **Multilingual:** All content is managed through Polylang. Use `pll_current_language()` and `pll_get_term_language()` when filtering by language. **Email templates** in theme root: `email-order.php`, `email-order-modal.php`, `email-order-success.php`. **Custom page templates:** `page-main.php`, `page-contacts.php`. ## Code Style Follow the style already present in the codebase: - **PHP brace style**: Allman (opening brace on a new line) - **PHP control structures**: no braces for single-statement bodies (space-separated on next line) - **Closures/callbacks**: use anonymous functions (`function() { ... }`) passed directly to `add_action` / `add_filter` - **No classes** for theme code — use procedural functions - **Indentation**: 4 spaces - Sanitize all external input; use `filter_var()` / WordPress sanitization functions - Do not use `esc_html()` for values entered via admin part ## Installation Checklist (New Project) 1. Clone repo and rename folder to project domain (e.g. `magnitbuilding.uz`) 2. Create empty MySQL database with `utf8mb4_general_ci` collation 3. Import `install/oqila-wp.sql` 4. Run `./install/secure_site_dir` to set file permissions (Linux) 5. `cp wp-config-local.php.dist wp-config-local.php` and fill in DB credentials + site URL 6. `cp .htaccess.dist .htaccess` 7. Create empty `DEBUG` file for local development 8. Set a new git remote: `git remote set-url origin <new-repo-url>` 9. Admin panel: `http://<domain>/boshqaruv` — default credentials in README.md ## Security Notes - Login URL is `/boshqaruv` (not `/wp-login.php`) — do not hardcode `/wp-login.php` in any code - `FS_METHOD` is set to `direct` in `wp-config-local.php` to avoid FTP prompts
Save File
Cancel