feat(wpml): refactor to post_content + duplicate site in French via WPML
This commit makes the site editable from WP admin (Gutenberg or Bricks "Edit with Bricks") and translatable via WPML Translation Editor by shifting page rendering away from Custom Templates and into post_content. Architecture change ------------------- Before: Custom Templates assigned to each page (page-solution-detail.php etc.) generated the page HTML at runtime by reading from inc/*-data.php arrays. WPML had nothing to translate, Bricks Builder had nothing to edit, the client could only modify content by editing PHP. After: - Pages now hold their full Gutenberg HTML inside post_content - The default page.php template renders the_content() — no Custom Templates assigned anymore - Bricks Builder picks up post_content and converts it to its element tree when "Edit with Bricks" is clicked - WPML Translation Editor exposes every block for translation - The client can edit pages directly in WP admin What this commit ships ---------------------- - inc/render-blocks.php: data array → Gutenberg HTML payload generator with helpers per section type (prose / cards / list / cta) and per page archetype (solution / industry / technology / editorial / form / overview hub). - inc/shortcodes.php: [av_form slug="request-demo"] for dynamic form blocks (forms can't live as static HTML — they need nonces and per-request state). - inc/i18n.php: av_lang() / av_t() helpers for inline string translation in header.php and footer.php (covers ~80 UI strings); switches based on WPML's wpml_current_language filter. - page.php: minimal default template — get_header() + the_content() + get_footer(). - header.php: real WPML language switcher driven by wpml_active_languages filter (replaces the placeholder EN · FR toggle); UI strings now route through av_t(). - footer.php: same UI string treatment. - Custom Templates retained but no longer assigned (pages were stripped by the migration mu-plugin); they remain available if a page wants to opt back into the data-file pattern. Operational migrations (one-shot mu-plugins, not versioned) ----------------------------------------------------------- 1. asterion-migrate-to-blocks.php walked all 26 PHP-templated pages, pre-rendered them via the new render-blocks helpers, wrote the result to post_content, and stripped _wp_page_template. 2. asterion-duplicate-fr.php cloned all 35 pages into French via WPML API, preserved parent/child hierarchy, linked translations through the trid table, marked them as duplicates pending refinement. 3. asterion-fix-fr-slugs.php aligned French slugs with English ones (WP's wp_unique_post_slug() had appended -2 suffixes; we bypass via $wpdb->update so /fr/solutions/ resolves correctly). Verified -------- - All 35 EN URLs return HTTP 200 - All 35 FR URLs return HTTP 200 under /fr/<slug>/ - Language switcher in header outputs correct hreflang links - WPML emits hreflang en / fr / x-default in <head> - Body class confirms wp-child-theme-asterion-bricks active - Bricks frontend CSS still enqueued - Inter Variable still preloaded Next steps ---------- - French content is currently the duplicated EN copy. Translate via WP admin → WPML → Translation Editor (per-block UI), or edit pages directly in /fr/<slug>/ via Gutenberg / Bricks - WPML String Translation can scan the theme to surface av_t() / __() strings for UI-level translation overrides Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,12 +25,12 @@ $av_year = date_i18n('Y');
|
||||
ASTERION VR
|
||||
</a>
|
||||
<p>
|
||||
<?php esc_html_e('The modular, sovereign XR platform for European security forces. Train like the threat is now.', 'asterion-bricks'); ?>
|
||||
<?php echo esc_html(av_t('The modular, sovereign XR platform for European security forces. Train like the threat is now.', 'asterion-bricks')); ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="av-footer__col">
|
||||
<h2 class="av-footer__col-title"><?php esc_html_e('Solutions', 'asterion-bricks'); ?></h2>
|
||||
<h2 class="av-footer__col-title"><?php echo esc_html(av_t('Solutions', 'asterion-bricks')); ?></h2>
|
||||
<ul class="av-footer__list">
|
||||
<li><a href="<?php echo esc_url(home_url('/solutions/my-proserve/')); ?>">MY PROSERVE</a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/solutions/proserve-flex/')); ?>">PROSERVE FLEX</a></li>
|
||||
@@ -40,46 +40,46 @@ $av_year = date_i18n('Y');
|
||||
</div>
|
||||
|
||||
<div class="av-footer__col">
|
||||
<h2 class="av-footer__col-title"><?php esc_html_e('Industries', 'asterion-bricks'); ?></h2>
|
||||
<h2 class="av-footer__col-title"><?php echo esc_html(av_t('Industries', 'asterion-bricks')); ?></h2>
|
||||
<ul class="av-footer__list">
|
||||
<li><a href="<?php echo esc_url(home_url('/industries/police/')); ?>"><?php esc_html_e('Police', 'asterion-bricks'); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/industries/special-forces/')); ?>"><?php esc_html_e('Special Forces', 'asterion-bricks'); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/industries/military/')); ?>"><?php esc_html_e('Military', 'asterion-bricks'); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/industries/firefighters/')); ?>"><?php esc_html_e('Firefighters', 'asterion-bricks'); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/industries/police/')); ?>"><?php echo esc_html(av_t('Police', 'asterion-bricks')); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/industries/special-forces/')); ?>"><?php echo esc_html(av_t('Special Forces', 'asterion-bricks')); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/industries/military/')); ?>"><?php echo esc_html(av_t('Military', 'asterion-bricks')); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/industries/firefighters/')); ?>"><?php echo esc_html(av_t('Firefighters', 'asterion-bricks')); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="av-footer__col">
|
||||
<h2 class="av-footer__col-title"><?php esc_html_e('Why Asterion', 'asterion-bricks'); ?></h2>
|
||||
<h2 class="av-footer__col-title"><?php echo esc_html(av_t('Why Asterion', 'asterion-bricks')); ?></h2>
|
||||
<ul class="av-footer__list">
|
||||
<li><a href="<?php echo esc_url(home_url('/about/')); ?>"><?php esc_html_e('Our story', 'asterion-bricks'); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/customers/')); ?>"><?php esc_html_e('Customers', 'asterion-bricks'); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/trust/')); ?>"><?php esc_html_e('Trust & Compliance', 'asterion-bricks'); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/partners/')); ?>"><?php esc_html_e('Partners', 'asterion-bricks'); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/about/')); ?>"><?php echo esc_html(av_t('Our story', 'asterion-bricks')); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/customers/')); ?>"><?php echo esc_html(av_t('Customers', 'asterion-bricks')); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/trust/')); ?>"><?php echo esc_html(av_t('Trust & Compliance', 'asterion-bricks')); ?></a></li>
|
||||
<li><a href="<?php echo esc_url(home_url('/partners/')); ?>"><?php echo esc_html(av_t('Partners', 'asterion-bricks')); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="av-footer__newsletter">
|
||||
<h2 class="av-footer__col-title"><?php esc_html_e('Newsletter', 'asterion-bricks'); ?></h2>
|
||||
<h2 class="av-footer__col-title"><?php echo esc_html(av_t('Newsletter', 'asterion-bricks')); ?></h2>
|
||||
<p style="color:var(--color-text-on-dark-muted);font-size:var(--text-body-sm);">
|
||||
<?php esc_html_e('Insights from the front of immersive training. One email per month. No spam.', 'asterion-bricks'); ?>
|
||||
<?php echo esc_html(av_t('Insights from the front of immersive training. One email per month. No spam.', 'asterion-bricks')); ?>
|
||||
</p>
|
||||
<form class="av-footer__newsletter-form" method="post" action="#" aria-label="<?php esc_attr_e('Newsletter signup', 'asterion-bricks'); ?>">
|
||||
<label for="av-newsletter-email" class="av-sr-only"><?php esc_html_e('Your email', 'asterion-bricks'); ?></label>
|
||||
<label for="av-newsletter-email" class="av-sr-only"><?php echo esc_html(av_t('Your email', 'asterion-bricks')); ?></label>
|
||||
<input type="email" id="av-newsletter-email" name="email" class="av-input" placeholder="<?php esc_attr_e('your@email.com', 'asterion-bricks'); ?>" required>
|
||||
<button type="submit" class="av-btn av-btn--primary av-btn--md"><?php esc_html_e('Subscribe', 'asterion-bricks'); ?></button>
|
||||
<button type="submit" class="av-btn av-btn--primary av-btn--md"><?php echo esc_html(av_t('Subscribe', 'asterion-bricks')); ?></button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="av-footer__bottom">
|
||||
<div>© <?php echo esc_html($av_year); ?> Asterion VR. <?php esc_html_e('All rights reserved.', 'asterion-bricks'); ?></div>
|
||||
<div>© <?php echo esc_html($av_year); ?> Asterion VR. <?php echo esc_html(av_t('All rights reserved.', 'asterion-bricks')); ?></div>
|
||||
<div class="av-footer__bottom-links">
|
||||
<a href="<?php echo esc_url(home_url('/legal/privacy/')); ?>"><?php esc_html_e('Privacy', 'asterion-bricks'); ?></a>
|
||||
<a href="<?php echo esc_url(home_url('/legal/terms/')); ?>"><?php esc_html_e('Terms', 'asterion-bricks'); ?></a>
|
||||
<a href="<?php echo esc_url(home_url('/legal/cookies/')); ?>"><?php esc_html_e('Cookies', 'asterion-bricks'); ?></a>
|
||||
<a href="<?php echo esc_url(home_url('/legal/notice/')); ?>"><?php esc_html_e('Legal notice', 'asterion-bricks'); ?></a>
|
||||
<a href="<?php echo esc_url(home_url('/legal/privacy/')); ?>"><?php echo esc_html(av_t('Privacy', 'asterion-bricks')); ?></a>
|
||||
<a href="<?php echo esc_url(home_url('/legal/terms/')); ?>"><?php echo esc_html(av_t('Terms', 'asterion-bricks')); ?></a>
|
||||
<a href="<?php echo esc_url(home_url('/legal/cookies/')); ?>"><?php echo esc_html(av_t('Cookies', 'asterion-bricks')); ?></a>
|
||||
<a href="<?php echo esc_url(home_url('/legal/notice/')); ?>"><?php echo esc_html(av_t('Legal notice', 'asterion-bricks')); ?></a>
|
||||
</div>
|
||||
<div class="av-footer__social">
|
||||
<a href="https://www.linkedin.com/company/asterion-vr/" rel="noopener" aria-label="LinkedIn">LinkedIn</a>
|
||||
|
||||
Reference in New Issue
Block a user