chore: phase 1 reset — minimalist child theme + content-source extraction

Resets the child theme to its Bricks-first minimalist form (per RESTART-PLAN.md
phases 1a-1d) and extracts the textual copy into a runtime-independent
/content-source/ directory.

Child theme files removed
- header.php, footer.php, page.php, index.php, front-page.php
- template-parts/{solution,industry,conversion-form}.php
- templates/page-*.php (10 Custom Page Templates)
- inc/render-blocks.php, render-blocks-native.php, render-bricks.php
- inc/shortcodes.php, i18n.php, form-handler.php, seo.php
- assets/css/components.css, assets/js/main.js

Reasoning: Bricks Templates (Header / Footer / Single — Page) and Bricks-edited
pages now drive every screen. Anything emitted from the child theme would
fight Bricks' own rendering and waste CSS specificity battles.

Child theme now contains only
- style.css, functions.php (simplified to ~60 lines), theme.json
- inc/cpt.php (case_study + scenario + industry taxonomy)
- assets/css/tokens.css (untouched — design system source of truth)
- assets/css/utilities.css (trimmed to skip-link + sr-only + focus-visible
  + reduced motion — everything else handled by Bricks)
- assets/fonts/Inter-Variable*.woff2 (RGPD self-hosted)
- README.md spelling out the Bricks-first contract

Content moved to /content-source/
- solutions-data.php, industries-data.php, technology-data.php,
  editorial-data.php, forms-data.php — git mv preserves history
- README.md explaining their dual role: copy reference while building
  in Bricks, and source for programmatic page generation when we
  replicate an archetype across its variants.

Root README.md updated with the new repo layout + a pointer to
RESTART-PLAN.md and the archive/session-2-php-templates branch.

Memory file project_asterion_status.md updated for next-session resume.

What's preserved as before
- /BRIEF-Claude-Code.md, both PDFs, all .txt extracts
- /MISSING-ASSETS.md
- /ThirdParty/ (Bricks + WPML ZIPs, gitignored)
- LocalWP site at localhost:10004, Bricks v2.3.4 + WPML 4.9.3 active
- WPML EN/FR with directory URL strategy
- All Git history, both main and archive/session-2-php-templates branches

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-09 14:36:19 +02:00
parent 026be81373
commit fba223004f
39 changed files with 217 additions and 5025 deletions

View File

@@ -1,35 +1,38 @@
<?php
/**
* Asterion Bricks — child theme bootstrap
* Asterion Bricks — Child theme bootstrap (minimalist, Bricks-first)
*
* Loads design tokens, utilities, components, and main JS in a deterministic
* order. Registers theme support, image sizes, and includes modular pieces
* (custom post types, SEO schemas).
* Goals
* -----
* 1. Provide the design system to Bricks Builder via tokens.css.
* 2. Self-host Inter fonts so Bricks-rendered pages stay GDPR-compliant.
* 3. Register Custom Post Types (case_study, scenario) used across the site.
*
* Non-goals (intentionally NOT here, on purpose)
* ----------------------------------------------
* ✗ No header.php / footer.php / page.php / front-page.php / index.php.
* Bricks Templates (Header / Footer / Single — Page) drive the chrome.
* ✗ No Custom Page Templates. Pages render through Bricks data.
* ✗ No PHP renderers. Content lives in Bricks data + WPML translations.
* ✗ No Gutenberg block libraries dequeued. Bricks needs them in the builder.
*
* @package AsterionBricks
* @since 0.1.0
* @since 0.2.0
*/
defined('ABSPATH') || exit;
define('AV_THEME_VERSION', '0.1.0');
define('AV_THEME_VERSION', '0.2.0');
define('AV_THEME_DIR', get_stylesheet_directory());
define('AV_THEME_URI', get_stylesheet_directory_uri());
/**
* Enqueue child theme styles and scripts.
*
* Bricks parent stylesheet is loaded by the parent theme itself — no need to
* re-enqueue. We layer our tokens → utilities → components on top.
*
* Cache busting via `filemtime()` so dev changes are picked up without manual
* version bumps. In production, swap to AV_THEME_VERSION + a build step.
* Enqueue tokens.css + utilities.css on the public frontend AND inside the
* Bricks Builder iframe — the builder loads the front-end stylesheet so we
* see our `--color-*`, `--space-*`, `--font-*` variables as we work.
*/
add_action('wp_enqueue_scripts', function () {
$css_dir = AV_THEME_DIR . '/assets/css';
$css_uri = AV_THEME_URI . '/assets/css';
$js_dir = AV_THEME_DIR . '/assets/js';
$js_uri = AV_THEME_URI . '/assets/js';
$css_dir = AV_THEME_DIR . '/assets/css';
$css_uri = AV_THEME_URI . '/assets/css';
if (file_exists($css_dir . '/tokens.css')) {
wp_enqueue_style(
@@ -39,7 +42,6 @@ add_action('wp_enqueue_scripts', function () {
filemtime($css_dir . '/tokens.css')
);
}
if (file_exists($css_dir . '/utilities.css')) {
wp_enqueue_style(
'av-utilities',
@@ -48,82 +50,25 @@ add_action('wp_enqueue_scripts', function () {
filemtime($css_dir . '/utilities.css')
);
}
if (file_exists($css_dir . '/components.css')) {
wp_enqueue_style(
'av-components',
$css_uri . '/components.css',
['av-tokens', 'av-utilities'],
filemtime($css_dir . '/components.css')
);
}
if (file_exists($js_dir . '/main.js')) {
wp_enqueue_script(
'av-main',
$js_uri . '/main.js',
[],
filemtime($js_dir . '/main.js'),
['strategy' => 'defer', 'in_footer' => true]
);
}
}, 20);
/**
* Preload self-hosted Inter fonts to reduce LCP.
*
* Only emits <link rel="preload"> for fonts that actually exist on disk —
* silent during early dev when the WOFF2 files have not been dropped yet.
* Preload the Inter Variable WOFF2 to reduce LCP. Conditional on the file
* existing so partial deploys don't 404.
*/
add_action('wp_head', function () {
$fonts = [
'Inter-Variable.woff2',
// 'InterDisplay-Variable.woff2',
];
foreach ($fonts as $font) {
$path = AV_THEME_DIR . '/assets/fonts/' . $font;
if (file_exists($path)) {
printf(
'<link rel="preload" href="%s/assets/fonts/%s" as="font" type="font/woff2" crossorigin>' . "\n",
esc_url(AV_THEME_URI),
esc_attr($font)
);
}
$font_path = AV_THEME_DIR . '/assets/fonts/Inter-Variable.woff2';
if (file_exists($font_path)) {
printf(
'<link rel="preload" href="%s/assets/fonts/Inter-Variable.woff2" as="font" type="font/woff2" crossorigin>' . "\n",
esc_url(AV_THEME_URI)
);
}
}, 1);
/**
* Modular includes.
*
* Each file is opt-in via file_exists() so partial scaffolds don't fatal.
*/
$av_includes = [
'inc/i18n.php', // av_lang(), av_t() — load FIRST.
'inc/cpt.php', // Custom post types: case_study, scenario.
'inc/seo.php', // Schema.org JSON-LD overrides.
'inc/form-handler.php', // Conversion form POST handler.
'inc/render-blocks.php', // Data array → core/html migrator (legacy, kept for fallback).
'inc/render-blocks-native.php', // Data array → native Gutenberg blocks (legacy POC).
'inc/render-bricks.php', // Data array → Bricks Builder native elements (current target).
'inc/shortcodes.php', // [av_form slug="..."] etc.
];
foreach ($av_includes as $av_include) {
$path = AV_THEME_DIR . '/' . $av_include;
if (file_exists($path)) {
require_once $path;
}
}
unset($av_include, $path);
/**
* Theme support and custom image sizes.
*
* Image sizes per Design Handoff section 8.3:
* - hero 2400×1350 (16:9)
* - card 800×600 (4:3)
* - thumb 400×300 (4:3)
* Theme support + custom image sizes (used by Bricks media controls and
* Schema.org/OpenGraph emitters down the line).
*/
add_action('after_setup_theme', function () {
add_theme_support('post-thumbnails');
@@ -133,41 +78,25 @@ add_action('after_setup_theme', function () {
]);
add_theme_support('responsive-embeds');
add_theme_support('align-wide');
add_theme_support('editor-styles');
add_image_size('av-hero', 2400, 1350, true);
add_image_size('av-card', 800, 600, true);
add_image_size('av-thumb', 400, 300, true);
add_image_size('av-hero', 2400, 1350, true); // 16:9 hero
add_image_size('av-card', 800, 600, true); // 4:3 card
add_image_size('av-thumb', 400, 300, true); // 4:3 thumb
load_child_theme_textdomain('asterion-bricks', AV_THEME_DIR . '/languages');
});
/**
* Hide the WP admin bar on frontend for non-admins (cleaner preview screenshots).
* Modular includes — currently only CPT registration. SEO and other modules
* will be added as needed; the include loop is opt-in via file_exists().
*/
add_action('after_setup_theme', function () {
if (! current_user_can('administrator')) {
show_admin_bar(false);
$av_includes = [
'inc/cpt.php',
];
foreach ($av_includes as $av_include) {
$path = AV_THEME_DIR . '/' . $av_include;
if (file_exists($path)) {
require_once $path;
}
});
/**
* Disable Gutenberg block library default styles on the public frontend only —
* we own typography end-to-end through tokens.css.
*
* Skipped when:
* - inside the Bricks Builder canvas (?bricks=run, ?brickspreview=1) — those
* screens rely on the WP-core stylesheets for their own UI / preview.
* - in the WP admin itself.
*/
add_action('wp_enqueue_scripts', function () {
if (is_admin()) return;
if (function_exists('bricks_is_builder') && bricks_is_builder()) return;
if (function_exists('bricks_is_frontend_builder_iframe') && bricks_is_frontend_builder_iframe()) return;
if (! empty($_GET['bricks']) || ! empty($_GET['brickspreview'])) return;
wp_dequeue_style('wp-block-library');
wp_dequeue_style('wp-block-library-theme');
wp_dequeue_style('global-styles');
wp_dequeue_style('classic-theme-styles');
}, 100);
}
unset($av_include, $path);