Sessions 3-4 deliverables. Establishes the Asterion content pipeline :
EN pages generated programmatically from content-source/*-data.php, FR
translations rebuilt natively by Bricks's WPML integration from EN structure
+ WPML strings (no direct FR _bricks_page_content_2 writes).
## tools/_av-bricks-shared.php (the library)
Shared helpers + element atoms (eyebrow/heading/text/button/text-link) +
section builders (hero/prose/list/cards/cta/upsell/closer) + page write
pipeline that handles : write EN content via $wpdb (bypass Bricks's filter),
force Bricks::Elements::load_elements() so controls are populated, fire
wpml_page_builder_register_strings, push dict FR into icl_string_translations
(skip user CTE edits, auto-prefix /fr on internal URLs), trigger Bricks
native FR rebuild via wpml_page_builder_string_translated, and ensure a CTE
job exists (icl_translate_job.editor='wpml' + revision=NULL + populate
icl_translate rows with base64+gzip-encoded EN/FR strings).
## tools/av-generate-{industries,solutions}.php
Thin wrappers : URL trigger (template_redirect, not init — Bricks elements
load on 'wp' hook), add_filter('av_fr_translation_dict', ...) to register
FR strings, content-type-specific hub builder. ~150 FR strings per type.
## tools/av-translate-{industries,solutions}-fr.php
One-shot seeds for the initial FR linked posts via WPML trid mapping.
## tools/av-wpml-* operational mu-plugins
- set-cte : switch doc_translation_method to ICL_TM_TMETHOD_EDITOR (=1)
- create-jobs : reset CTE jobs (status=10 + needs_update=1 + editor=wpml +
revision=NULL). Integrated into pipeline via av_ensure_wpml_cte_job().
- fix-status / repair : align FR posts to correct trid + cleanup orphans.
- push-translations : push dict into icl_string_translations.
- plugins-check / debug / dump-strings / icl-dump / rescan : diagnostics.
## tools/av-fix-link-types.php
One-shot DB migration : convert legacy link.type='internal'+url to 'external'
across all _bricks_page_*_2 meta values (JSON and PHP-serialized). Bricks's
set_link_attributes() only renders href= for type='external' — older session-3
templates lost their href silently.
## Other tools/ mu-plugins
- av-bricks-rest-bridge : pivot — exposes Bricks CPTs over REST, dual-format
read filter (JSON for MCP / array for renderer), auto-mirror content→header/
footer for templates.
- av-apply-bricks-styles, av-cleanup-orphans, av-create-wp-menu, av-debug-meta,
av-dump-bricks, av-fix-template-meta : misc operational scripts.
## Bricks Config/
JSON snapshots of bricks_theme_styles, bricks_color_palette,
bricks_global_settings for diffable inspection.
## .gitignore
Add .mcp.json — holds per-developer WP App Password for the Bricks MCP server.
## wp-content/themes/asterion-bricks/assets/css/utilities.css
Note that all responsive overrides are now emitted natively by the page
generator via Bricks per-breakpoint settings, no custom CSS needed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
70 lines
4.3 KiB
Markdown
70 lines
4.3 KiB
Markdown
# Tools
|
|
|
|
One-shot scripts and helpers used during project setup or migrations. They are NOT part of the published site.
|
|
|
|
## fresh-setup-mu-plugin.php
|
|
|
|
Drop into `wp-content/mu-plugins/` of a freshly created LocalWP site to auto-configure WordPress for the Asterion VR project. Read its inline header for the full procedure.
|
|
|
|
Quick recap :
|
|
|
|
1. Delete the old LocalWP site (right-click → Delete site, optionally move folder to trash).
|
|
2. Create a new LocalWP site named "Asterion 2026", mode `localhost`, default credentials.
|
|
3. Note the allocated port — likely `10004` again. **If different, edit `AV_TARGET_HOME` in `fresh-setup-mu-plugin.php` first.**
|
|
4. Junction the child theme into the new site:
|
|
```powershell
|
|
New-Item -ItemType Junction `
|
|
-Path "C:\Users\j_foucher\Local Sites\asterion-2026\app\public\wp-content\themes\asterion-bricks" `
|
|
-Target "C:\ASTERION\GIT\WP2026\wp-content\themes\asterion-bricks"
|
|
```
|
|
5. Extract the Bricks parent **theme** into `wp-content/themes/`. Bricks is a theme (not a plugin) — installing the ZIP via WP admin → Plugins → Add New will fail with "No valid plugins were found".
|
|
```powershell
|
|
$site = "C:\Users\j_foucher\Local Sites\asterion-2026\app\public\wp-content"
|
|
Expand-Archive "C:\ASTERION\GIT\WP2026\ThirdParty\bricks.2.3.4.zip" "$site\themes\" -Force
|
|
```
|
|
(Or via WP admin → Appearance → Themes → Add New Theme → Upload Theme.)
|
|
6. Extract WPML **plugin** into `wp-content/plugins/`:
|
|
```powershell
|
|
Expand-Archive "C:\ASTERION\GIT\WP2026\ThirdParty\sitepress-multilingual-cms.4.9.3.zip" "$site\plugins\" -Force
|
|
```
|
|
(Or via WP admin → Plugins → Add New → Upload Plugin.)
|
|
7. Copy `tools/fresh-setup-mu-plugin.php` → `<NEW_SITE>\app\public\wp-content\mu-plugins\fresh-setup-mu-plugin.php`
|
|
8. Visit `http://localhost:10004/` once. The plugin runs at `init` priority 50, configures everything, and self-deletes after success.
|
|
9. Verify by hitting `http://localhost:10004/wp-admin` — login, then check that:
|
|
- Theme : Asterion Bricks active (parent: Bricks)
|
|
- Plugins : WPML active
|
|
- Settings → Permalinks : Post name (`/%postname%/`)
|
|
- Bricks → Settings → Builder access : Page + Post + case_study + scenario checked
|
|
|
|
Then activate the Bricks license (Bricks → License) and run the WPML setup wizard manually — those need your license keys and an interactive choice flow that's safer to do in admin.
|
|
|
|
## av-apply-bricks-styles.php
|
|
|
|
One-shot mu-plugin that writes the full Asterion Theme Style to `wp_options` (`bricks_theme_styles`) AND fixes `bricks_global_settings.postTypes` to include `page, post, case_study, scenario`.
|
|
|
|
Why a mu-plugin : Bricks stores Theme Styles as serialized PHP in the DB (not in a file), so we need code that runs in the WP context. Mu-plugin URL trigger is the simplest path; LocalWP CLI PHP can't connect to the per-site MySQL socket without extra config.
|
|
|
|
Usage :
|
|
|
|
1. Copy this file → `<LocalWP site>\app\public\wp-content\mu-plugins\av-apply-bricks-styles.php`
|
|
2. Visit `http://localhost:10004/?av_apply_styles=1` (logged in as admin)
|
|
3. A dark-themed report shows what was written.
|
|
4. Reload the Bricks builder (Ctrl+R) → Theme Style "Asterion" applied to entire website.
|
|
|
|
Idempotent — re-running overwrites with the same payload. Edit the file then re-trigger to iterate.
|
|
|
|
Sets : General (site bg), Colors (11 semantic roles), Links (gold + underline), Typography (Inter, body 16px, h1-h6 sizes from `tokens.css`), Button (primary navy, secondary gold, padding scale), Section (5rem padding), Container (max 1280px), Focus outline.
|
|
|
|
## av-dump-bricks.php
|
|
|
|
One-shot mu-plugin that exports the live `bricks_theme_styles`, `bricks_color_palette`, `bricks_global_settings` options to JSON files in `Bricks Config/` for inspection or git-versioned snapshots.
|
|
|
|
Usage : drop into mu-plugins, visit `?av_dump_bricks=1` (admin), three JSONs appear in `Bricks Config/`.
|
|
|
|
## What's missing — manual follow-up after fresh setup
|
|
|
|
- Bricks license key activation (Bricks → License)
|
|
- WPML setup wizard (WPML → Setup) : EN default + FR secondary, URL strategy = "Different languages in directories"
|
|
- Run `?av_apply_styles=1` (see above) to push the Theme Style — replaces clicking through Bricks → Theme Styles.
|
|
- Build the Header and Footer Bricks Templates (per RESTART-PLAN.md Phase 4)
|