feat(home): cinematic video-background hero with overlay text
Replaces the home page's plain-navy hero with a full-bleed video-background
section + dark navy overlay (60%) for text readability. The video URL is
read from the WP option `av_home_hero_video_url`. If empty, the hero
gracefully falls back to a solid navy background — same layout, same text,
just no video.
Settings (Bricks-native background.videoUrl pattern from container.php
get_background_video_html) :
- videoUrl : the configured option value
- videoScale : 'cover'
- videoAspectRatio : '16/9'
- overlay : rgba(11,31,58,0.6) navy 60%
- color fallback while video loads
Typography :
- H1 : 3.5rem white, weight 800, tight letter-spacing, responsive
breakpoints down to 1.875rem on mobile
- Lead : muted-white rgba 0.85
- CTAs : gold primary + outline-on-dark secondary
Helper mu-plugin av-set-home-video.php :
/?av_set_home_video=https://...mp4 sets the URL
/?av_set_home_video=clear empties (back to navy)
Workflow :
1. Upload MP4 to Media Library, copy URL
2. /?av_set_home_video=<URL>
3. /?av_generate_home=1
4. Visit / — cinematic hero with looping muted autoplay video bg
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -116,16 +116,8 @@ add_action('template_redirect', function () {
|
|||||||
function av_build_home_elements() {
|
function av_build_home_elements() {
|
||||||
$els = [];
|
$els = [];
|
||||||
|
|
||||||
// 1. HERO — full bleed, large tagline
|
// 1. HERO — full-bleed cinematic video background + overlay text
|
||||||
$els = array_merge($els, av_build_hero('home', [
|
$els = array_merge($els, av_build_home_video_hero());
|
||||||
'eyebrow' => '',
|
|
||||||
'tagline' => 'Train like you operate.',
|
|
||||||
'hero_lead' => "PROSERVE\u{2122} is the modular XR training platform engineered for European security forces. Real recoil, autonomous AI, sovereign by design \u{2014} from solo officer to full academy.",
|
|
||||||
'ctas' => [
|
|
||||||
['label' => 'Book a demo', 'href' => '/request-demo/', 'variant' => 'primary'],
|
|
||||||
['label' => 'Request a T&E Kit', 'href' => '/request-te-kit/', 'variant' => 'secondary'],
|
|
||||||
],
|
|
||||||
]));
|
|
||||||
|
|
||||||
// 2. THREE PILLARS — 3-card grid (count===3 → 33% each, clean row of 3)
|
// 2. THREE PILLARS — 3-card grid (count===3 → 33% each, clean row of 3)
|
||||||
$els = array_merge($els, av_build_cards_section('homep', 0, [
|
$els = array_merge($els, av_build_cards_section('homep', 0, [
|
||||||
@@ -230,6 +222,136 @@ function av_build_home_elements() {
|
|||||||
return $els;
|
return $els;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cinematic full-bleed hero with background video + dark overlay + light text.
|
||||||
|
* Video URL is read from the WP option `av_home_hero_video_url`. If empty,
|
||||||
|
* the hero falls back to a solid navy background (no video) — the layout and
|
||||||
|
* text stay identical so the page renders cleanly even without a video.
|
||||||
|
*
|
||||||
|
* To set the video URL :
|
||||||
|
* 1. Upload your MP4 to WP Admin → Media Library
|
||||||
|
* 2. Copy the file URL
|
||||||
|
* 3. Run /?av_set_home_video=<URL> (see av-set-home-video.php mu-plugin)
|
||||||
|
* or update_option('av_home_hero_video_url', '<URL>') via WP CLI / DB
|
||||||
|
* 4. Re-run /?av_generate_home=1
|
||||||
|
*/
|
||||||
|
function av_build_home_video_hero() {
|
||||||
|
$video_url = (string) get_option('av_home_hero_video_url', '');
|
||||||
|
|
||||||
|
$sid = 'hhomesc';
|
||||||
|
$oct = 'hhomeoc';
|
||||||
|
$nrr = 'hhomenr';
|
||||||
|
$eybId = 'hhomeeb';
|
||||||
|
$h1Id = 'hhomeh1';
|
||||||
|
$ledId = 'hhomeld';
|
||||||
|
$rowId = 'hhomerw';
|
||||||
|
|
||||||
|
// Background settings : video if URL configured, otherwise navy color.
|
||||||
|
if ($video_url !== '') {
|
||||||
|
$section_background = [
|
||||||
|
'videoUrl' => $video_url,
|
||||||
|
'videoScale' => 'cover', // fill the section, crop if needed
|
||||||
|
'videoAspectRatio' => '16/9',
|
||||||
|
'overlay' => [
|
||||||
|
'color' => ['raw' => 'rgba(11, 31, 58, 0.6)'], // navy 60% — readability
|
||||||
|
],
|
||||||
|
'color' => ['raw' => 'var(--color-brand-navy)'], // fallback while video loads
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
$section_background = ['color' => av_color('var(--color-brand-navy)')];
|
||||||
|
}
|
||||||
|
|
||||||
|
$els = [];
|
||||||
|
|
||||||
|
// SECTION — full bleed, large vertical padding, video bg or navy
|
||||||
|
$els[] = [
|
||||||
|
'id' => $sid, 'name' => 'section', 'parent' => 0, 'children' => [$oct],
|
||||||
|
'settings' => [
|
||||||
|
'_padding' => av_sp('9rem', '0', '8rem', '0'),
|
||||||
|
'_padding:tablet_portrait' => av_sp('7rem', '0', '6rem', '0'),
|
||||||
|
'_padding:mobile_landscape' => av_sp('5rem', '0', '4rem', '0'),
|
||||||
|
'_padding:mobile_portrait' => av_sp('4rem', '0', '3.5rem', '0'),
|
||||||
|
'_background' => $section_background,
|
||||||
|
'_position' => 'relative',
|
||||||
|
'_overflow' => 'hidden',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// OUTER CONTAINER — 1280 max-width, no horizontal centering of inner
|
||||||
|
$els[] = [
|
||||||
|
'id' => $oct, 'name' => 'container', 'parent' => $sid, 'children' => [$nrr],
|
||||||
|
'settings' => [
|
||||||
|
'_direction' => 'column',
|
||||||
|
'_widthMax' => '1280px',
|
||||||
|
'_width' => '100%',
|
||||||
|
'_padding' => av_sp('0', '1.5rem', '0', '1.5rem'),
|
||||||
|
'_padding:mobile_landscape' => av_sp('0', '1rem', '0', '1rem'),
|
||||||
|
'_alignItems' => 'flex-start',
|
||||||
|
'_position' => 'relative',
|
||||||
|
'_zIndex' => '2', // above the video overlay
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// NARRATIVE INNER — 800 max-width, light text
|
||||||
|
$els[] = [
|
||||||
|
'id' => $nrr, 'name' => 'container', 'parent' => $oct, 'children' => [$h1Id, $ledId, $rowId],
|
||||||
|
'settings' => [
|
||||||
|
'_direction' => 'column',
|
||||||
|
'_widthMax' => '800px',
|
||||||
|
'_widthMin' => '0',
|
||||||
|
'_width' => '100%',
|
||||||
|
'_margin' => av_sp('0', 'auto', '0', '0'),
|
||||||
|
'_padding' => av_sp('0', '0', '0', '0'),
|
||||||
|
'_rowGap' => '1.5rem',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// H1 — large, white, tactical
|
||||||
|
$els[] = [
|
||||||
|
'id' => $h1Id, 'name' => 'heading', 'parent' => $nrr, 'children' => [],
|
||||||
|
'settings' => [
|
||||||
|
'tag' => 'h1',
|
||||||
|
'text' => 'Train like you operate.',
|
||||||
|
'_typography' => [
|
||||||
|
'color' => av_color('var(--color-text-on-dark)'),
|
||||||
|
'font-weight' => '800',
|
||||||
|
'font-size' => '3.5rem',
|
||||||
|
'line-height' => '1.1',
|
||||||
|
'letter-spacing'=> '-0.02em',
|
||||||
|
],
|
||||||
|
'_typography:tablet_portrait' => ['font-size' => '2.75rem'],
|
||||||
|
'_typography:mobile_landscape' => ['font-size' => '2.25rem'],
|
||||||
|
'_typography:mobile_portrait' => ['font-size' => '1.875rem'],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// LEAD — muted-white
|
||||||
|
$els[] = av_text(
|
||||||
|
$ledId, $nrr,
|
||||||
|
"PROSERVE\u{2122} is the modular XR training platform engineered for European security forces. Real recoil, autonomous AI, sovereign by design \u{2014} from solo officer to full academy.",
|
||||||
|
'rgba(255, 255, 255, 0.85)', '1.25rem', '1.55'
|
||||||
|
);
|
||||||
|
|
||||||
|
// CTA row
|
||||||
|
$b1 = 'hhomeb0';
|
||||||
|
$b2 = 'hhomeb1';
|
||||||
|
$els[] = [
|
||||||
|
'id' => $rowId, 'name' => 'container', 'parent' => $nrr, 'children' => [$b1, $b2],
|
||||||
|
'settings' => [
|
||||||
|
'_direction' => 'row',
|
||||||
|
'_columnGap' => '1rem',
|
||||||
|
'_rowGap' => '1rem',
|
||||||
|
'_flexWrap' => 'wrap',
|
||||||
|
'_width' => '100%',
|
||||||
|
'_padding' => av_sp('1rem', '0', '0', '0'),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$els[] = av_button($b1, $rowId, 'Book a demo', '/request-demo/', 'gold');
|
||||||
|
$els[] = av_button($b2, $rowId, 'Request a T&E Kit', '/request-te-kit/', 'outline-on-dark');
|
||||||
|
|
||||||
|
return $els;
|
||||||
|
}
|
||||||
|
|
||||||
function av_build_home_closer_cta() {
|
function av_build_home_closer_cta() {
|
||||||
$sid = "schmhc";
|
$sid = "schmhc";
|
||||||
$oct = "ochmhc";
|
$oct = "ochmhc";
|
||||||
|
|||||||
37
tools/av-set-home-video.php
Normal file
37
tools/av-set-home-video.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Plugin Name: Asterion — Set Home hero video URL (one-shot)
|
||||||
|
* Description:
|
||||||
|
* /?av_set_home_video=URL → stores the URL in WP option `av_home_hero_video_url`
|
||||||
|
* /?av_set_home_video=clear → empties the option (hero falls back to navy bg)
|
||||||
|
*
|
||||||
|
* After running, re-run /?av_generate_home=1 to apply the change to the hero.
|
||||||
|
*
|
||||||
|
* URL formats supported by Bricks's background video :
|
||||||
|
* - Self-hosted : https://yoursite.com/wp-content/uploads/.../video.mp4 (any MP4/WebM)
|
||||||
|
* - YouTube : full URL or ID
|
||||||
|
* - Vimeo : full URL or ID
|
||||||
|
*/
|
||||||
|
defined('ABSPATH') || exit;
|
||||||
|
|
||||||
|
add_action('template_redirect', function () {
|
||||||
|
if (! in_array($_SERVER['SERVER_NAME'] ?? '', ['localhost', '127.0.0.1'], true)) return;
|
||||||
|
if (! isset($_GET['av_set_home_video'])) return;
|
||||||
|
|
||||||
|
header('Content-Type: text/plain; charset=utf-8');
|
||||||
|
|
||||||
|
$url = trim((string) $_GET['av_set_home_video']);
|
||||||
|
$before = (string) get_option('av_home_hero_video_url', '');
|
||||||
|
|
||||||
|
if ($url === 'clear' || $url === '') {
|
||||||
|
delete_option('av_home_hero_video_url');
|
||||||
|
echo "Home hero video URL CLEARED (was: '$before')\n";
|
||||||
|
echo "Hero will fall back to solid navy background.\n";
|
||||||
|
} else {
|
||||||
|
update_option('av_home_hero_video_url', esc_url_raw($url));
|
||||||
|
echo "Home hero video URL set : '$before' → '" . esc_url_raw($url) . "'\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "\nNow re-run /?av_generate_home=1 to apply the change.\n";
|
||||||
|
exit;
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user