Brings the EN site to 34 live pages, completing the original sitemap from PDF Strategie & Contenu Partie C.1. Editorial section (5 pages, page-editorial-detail.php template) - /why-asterion/, /about/, /customers/, /trust/, /partners/ - inc/editorial-data.php centralizes the copy from D.18-D.21, D.28 - Reuses the industry-detail partial (same section schema) Conversion section (4 pages, page-conversion-form.php template) - /request-demo/, /request-te-kit/, /request-quote/, /contact/ - inc/forms-data.php declares fields per page (text/email/select/textarea) - template-parts/conversion-form.php renders two-column layout (form left, promise right), eligibility list (T&E), FAQ (Demo) - inc/form-handler.php: nonce-protected POST handler with honeypot, per-field sanitizer, wp_mail to AV_LEADS_RECIPIENT (defaults to jerome.foucher@asterionvr.com, override via wp-config.php define), redirect-back-with-status pattern. Insights & Resources (page-insights-hub.php, page-resources.php) - /insights/ queries `post`, falls back to placeholder when empty - /resources/ lists 4 resource groups (datasheets, whitepapers, videos, brochures) per D.23 Legal (page-legal.php template, parent + 4 children) - /legal/, /legal/privacy/, /legal/terms/, /legal/cookies/, /legal/notice/ - Renders page content if filled, falls back to slug-driven section skeleton (per D.29) for counsel to draft against. All 16 new URLs verified HTTP 200, sizes 49-66 KB each. Mu-plugin asterion-seed-rest.php in LocalWP self-deleted after seeding. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
159 lines
4.5 KiB
PHP
159 lines
4.5 KiB
PHP
<?php
|
||
/**
|
||
* Asterion Bricks — child theme bootstrap
|
||
*
|
||
* 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).
|
||
*
|
||
* @package AsterionBricks
|
||
* @since 0.1.0
|
||
*/
|
||
|
||
defined('ABSPATH') || exit;
|
||
|
||
define('AV_THEME_VERSION', '0.1.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.
|
||
*/
|
||
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';
|
||
|
||
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')
|
||
);
|
||
}
|
||
|
||
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.
|
||
*/
|
||
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)
|
||
);
|
||
}
|
||
}
|
||
}, 1);
|
||
|
||
/**
|
||
* Modular includes.
|
||
*
|
||
* Each file is opt-in via file_exists() so partial scaffolds don't fatal.
|
||
*/
|
||
$av_includes = [
|
||
'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.
|
||
];
|
||
|
||
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)
|
||
*/
|
||
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_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);
|
||
|
||
load_child_theme_textdomain('asterion-bricks', AV_THEME_DIR . '/languages');
|
||
});
|
||
|
||
/**
|
||
* Hide the WP admin bar on frontend for non-admins (cleaner preview screenshots).
|
||
*/
|
||
add_action('after_setup_theme', function () {
|
||
if (! current_user_can('administrator')) {
|
||
show_admin_bar(false);
|
||
}
|
||
});
|
||
|
||
/**
|
||
* Disable Gutenberg block library default styles when Bricks is active —
|
||
* we own typography end-to-end through tokens.css.
|
||
*/
|
||
add_action('wp_enqueue_scripts', function () {
|
||
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);
|