Files
AsterionWP2026/tools/av-fix-footer-headings.php
j.foucher a795fb345f style(footer): align nav-menu links with column heading + restore tagline visibility
Adds wp_head CSS overrides to fix two issues :
1. Footer nav-menu links (under Solutions / Company / Legal columns) were
   indented ~40px due to the browser's default <ul> padding-left. Zero it
   out so links align with the gold eyebrow heading above them.
2. Brand tagline "Your Last Mistake Should Be in VR." was using
   var(--color-text-tertiary) which renders too dark on the navy footer.
   Force rgba(255,255,255,0.65) for visible muted-white.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 21:07:10 +02:00

138 lines
5.3 KiB
PHP

<?php
/**
* Plugin Name: Asterion — Align + style footer column sub-titles
* /?av_fix_footer_headings=1
*
* Standardizes the 4 footer column headings (Solutions / Company / Legal /
* Contact) with eyebrow-style typography : gold, uppercase, letter-spacing,
* consistent size. Tightens the brand heading. Aligns columns to flex-start
* so sub-titles sit at the same vertical baseline.
*
* Idempotent — re-runs are safe.
*/
defined('ABSPATH') || exit;
/* -----------------------------------------------------------------
CSS overrides : reset <ul> default padding-left on footer nav-menus
so links align with their column heading. Also restore tagline color
that was inheriting too-dark var(--color-text-tertiary).
----------------------------------------------------------------- */
add_action('wp_head', function () {
?>
<style id="av-footer-overrides">
/* Footer nav-menu : remove default <ul> padding-left so links align with
the column heading (otherwise they look indented by ~40px). */
#brx-footer .bricks-nav-menu {
padding-left: 0 !important;
margin: 0 !important;
list-style: none !important;
}
#brx-footer .bricks-nav-menu li {
padding-left: 0 !important;
margin-left: 0 !important;
list-style: none !important;
}
#brx-footer .bricks-nav-menu > li {
padding: 0.25rem 0 !important;
}
#brx-footer .bricks-nav-menu > li > a {
padding: 0 !important;
font-size: 0.9rem;
line-height: 1.55;
}
/* Brand tagline : ensure it stays light/visible on the dark footer bg. */
#brxe-ftrtagln {
color: rgba(255, 255, 255, 0.65) !important;
}
</style>
<?php
}, 999);
add_action('template_redirect', function () {
if (! in_array($_SERVER['SERVER_NAME'] ?? '', ['localhost', '127.0.0.1'], true)) return;
if (empty($_GET['av_fix_footer_headings'])) return;
header('Content-Type: text/plain; charset=utf-8');
global $wpdb;
$eyebrow_typography = [
'color' => ['raw' => 'var(--color-brand-gold)'],
'font-size' => '0.75rem',
'font-weight' => '600',
'letter-spacing' => '0.1em',
'text-transform' => 'uppercase',
'line-height' => '1.4',
];
foreach (['_bricks_page_content_2', '_bricks_page_footer_2'] as $key) {
$val = $wpdb->get_var($wpdb->prepare(
"SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id=%d AND meta_key=%s LIMIT 1",
46, $key
));
if (! is_string($val) || $val === '') continue;
$is_json = ($val[0] === '[');
$elements = $is_json ? json_decode($val, true) : @unserialize($val);
if (! is_array($elements)) continue;
$changed = 0;
foreach ($elements as $i => $el) {
$id = $el['id'] ?? '';
// 1. Footer column sub-titles : eyebrow style
if (in_array($id, ['ftrh2', 'ftrh3', 'ftrh4', 'ftrh5'], true)) {
$elements[$i]['settings']['_typography'] = $eyebrow_typography;
$elements[$i]['settings']['_margin'] = ['top' => '0', 'right' => '0', 'bottom' => '0.5rem', 'left' => '0'];
$changed++;
}
// 2. Brand heading (ASTERION VR) — smaller so it doesn't dominate
if ($id === 'ftrbrnd') {
$elements[$i]['settings']['_typography'] = [
'color' => ['raw' => 'var(--color-text-on-dark)'],
'font-size' => '1.125rem',
'font-weight' => '600',
'letter-spacing' => '0.08em',
'line-height' => '1.4',
];
$elements[$i]['settings']['_margin'] = ['top' => '0', 'right' => '0', 'bottom' => '0.5rem', 'left' => '0'];
$changed++;
}
// 3. Brand tagline : muted, smaller
if ($id === 'ftrtagln') {
$elements[$i]['settings']['_typography'] = [
'color' => ['raw' => 'var(--color-text-tertiary)'],
'font-size' => '0.875rem',
'line-height' => '1.55',
];
$changed++;
}
// 4. Columns wrapper : align children to flex-start so column tops match
if ($id === 'ftrcols') {
$elements[$i]['settings']['_alignItems'] = 'flex-start';
$elements[$i]['settings']['_columnGap'] = '3rem';
$elements[$i]['settings']['_rowGap'] = '2.5rem';
$changed++;
}
// 5. Each column container : tight row gap between heading and content
if (in_array($id, ['ftrcol1', 'ftrcol2', 'ftrcol3', 'ftrcol4', 'ftrcol5'], true)) {
$elements[$i]['settings']['_rowGap'] = '0.5rem';
$changed++;
}
}
if ($changed > 0) {
$new = $is_json ? wp_json_encode($elements) : maybe_serialize($elements);
$wpdb->update($wpdb->postmeta, ['meta_value' => $new],
['post_id' => 46, 'meta_key' => $key], ['%s'], ['%d', '%s']);
wp_cache_delete(46, 'post_meta');
echo " $key : $changed element(s) patched\n";
}
}
echo "\nDONE. Reload any page → footer sub-titles now eyebrow-styled and aligned.\n";
exit;
});