Files
AsterionWP2026/wp-content/themes/asterion-bricks/functions.php
j.foucher fba223004f 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>
2026-05-09 14:36:19 +02:00

103 lines
3.4 KiB
PHP

<?php
/**
* Asterion Bricks — Child theme bootstrap (minimalist, Bricks-first)
*
* 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.2.0
*/
defined('ABSPATH') || exit;
define('AV_THEME_VERSION', '0.2.0');
define('AV_THEME_DIR', get_stylesheet_directory());
define('AV_THEME_URI', get_stylesheet_directory_uri());
/**
* 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';
if (file_exists($css_dir . '/tokens.css')) {
wp_enqueue_style(
'av-tokens',
$css_uri . '/tokens.css',
[],
filemtime($css_dir . '/tokens.css')
);
}
if (file_exists($css_dir . '/utilities.css')) {
wp_enqueue_style(
'av-utilities',
$css_uri . '/utilities.css',
['av-tokens'],
filemtime($css_dir . '/utilities.css')
);
}
}, 20);
/**
* Preload the Inter Variable WOFF2 to reduce LCP. Conditional on the file
* existing so partial deploys don't 404.
*/
add_action('wp_head', function () {
$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);
/**
* 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');
add_theme_support('html5', [
'search-form', 'comment-form', 'comment-list',
'gallery', 'caption', 'style', 'script',
]);
add_theme_support('responsive-embeds');
add_theme_support('align-wide');
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');
});
/**
* Modular includes — currently only CPT registration. SEO and other modules
* will be added as needed; the include loop is opt-in via file_exists().
*/
$av_includes = [
'inc/cpt.php',
];
foreach ($av_includes as $av_include) {
$path = AV_THEME_DIR . '/' . $av_include;
if (file_exists($path)) {
require_once $path;
}
}
unset($av_include, $path);