Wire header_nav_style transparent/blur, login history sync, plate publish type, clean dead search CSS, rebuild admin SPA locally (build gitignored).
114 lines
5.0 KiB
PHP
114 lines
5.0 KiB
PHP
<?php
|
|
/**
|
|
* Site header: document shell + zibll-contract top navigation.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
$aksrt_header_settings = class_exists('\AKSRT\Settings\Settings')
|
|
? \AKSRT\Settings\Settings::get_header_nav_settings()
|
|
: [
|
|
'fixed' => true,
|
|
'search_enabled' => true,
|
|
'user_menu' => true,
|
|
'publish_btn' => true,
|
|
'mobile_drawer' => true,
|
|
'nav_style' => 'default',
|
|
'max_width' => 1200,
|
|
'scroll_down_hide' => true,
|
|
'layout' => '1',
|
|
'mobile_layout' => 'center',
|
|
'mobile_align' => 'left',
|
|
];
|
|
|
|
$aksrt_initial_theme_mode = '';
|
|
if (class_exists('\AKSRT\Settings\Settings') && method_exists('\AKSRT\Settings\Settings', 'initial_theme_mode')) {
|
|
$aksrt_initial_theme_mode = \AKSRT\Settings\Settings::initial_theme_mode();
|
|
}
|
|
$aksrt_has_initial_theme = in_array($aksrt_initial_theme_mode, ['dark', 'light'], true);
|
|
|
|
$aksrt_body_classes = [];
|
|
// Zibll: body.nav-fixed drives top padding + hero pull-under-nav.
|
|
if (!empty($aksrt_header_settings['fixed'])) {
|
|
$aksrt_body_classes[] = 'nav-fixed';
|
|
} else {
|
|
$aksrt_body_classes[] = 'has-static-nav';
|
|
}
|
|
|
|
if ($aksrt_initial_theme_mode === 'dark') {
|
|
$aksrt_body_classes[] = 'theme-dark';
|
|
$aksrt_body_classes[] = 'dark-theme';
|
|
} elseif ($aksrt_initial_theme_mode === 'light') {
|
|
$aksrt_body_classes[] = 'white-theme';
|
|
}
|
|
if (!empty($aksrt_header_settings['scroll_down_hide']) && !empty($aksrt_header_settings['fixed'])) {
|
|
$aksrt_body_classes[] = 'scroll-down-hide';
|
|
}
|
|
$aksrt_body_classes[] = 'header-layout-' . $aksrt_header_settings['layout'];
|
|
$aksrt_body_classes[] = 'mobile-header-' . $aksrt_header_settings['mobile_layout'];
|
|
$aksrt_body_classes[] = 'mobile-nav-' . $aksrt_header_settings['mobile_align'];
|
|
// header_nav_style → body class for transparent / blur chrome.
|
|
$aksrt_nav_style = sanitize_key((string) ($aksrt_header_settings['nav_style'] ?? 'default'));
|
|
if (in_array($aksrt_nav_style, ['transparent', 'blur'], true)) {
|
|
$aksrt_body_classes[] = 'header-nav-style-' . $aksrt_nav_style;
|
|
}
|
|
|
|
// Global background system.
|
|
$aksrt_bg_settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_global_background_settings() : [];
|
|
$aksrt_bg_styles = [];
|
|
if (!empty($aksrt_bg_settings['bg_color'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-bg-color:' . sanitize_hex_color($aksrt_bg_settings['bg_color']);
|
|
}
|
|
if (!empty($aksrt_bg_settings['bg_image'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-bg-image:url(' . esc_url($aksrt_bg_settings['bg_image']) . ')';
|
|
$aksrt_bg_styles[] = '--aksrt-bg-size:' . sanitize_key($aksrt_bg_settings['bg_size'] ?: '100%');
|
|
$aksrt_bg_styles[] = '--aksrt-bg-position:' . sanitize_text_field($aksrt_bg_settings['bg_position'] ?: 'center center');
|
|
$aksrt_bg_styles[] = '--aksrt-bg-repeat:' . sanitize_key($aksrt_bg_settings['bg_repeat'] ?: 'no-repeat');
|
|
$aksrt_bg_styles[] = '--aksrt-bg-attachment:' . sanitize_key($aksrt_bg_settings['bg_attachment'] ?: 'fixed');
|
|
}
|
|
if (!empty($aksrt_bg_settings['bg_dark_color'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-bg-dark-color:' . sanitize_hex_color($aksrt_bg_settings['bg_dark_color']);
|
|
}
|
|
if (!empty($aksrt_bg_settings['bg_dark_image'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-bg-dark-image:url(' . esc_url($aksrt_bg_settings['bg_dark_image']) . ')';
|
|
}
|
|
if (!empty($aksrt_bg_settings['bg_overlay'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-bg-overlay-color:' . sanitize_text_field($aksrt_bg_settings['bg_overlay_color'] ?: 'rgba(0, 0, 0, 0.3)');
|
|
}
|
|
if (!empty($aksrt_bg_settings['page_bg_color'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-page-bg-color:' . sanitize_hex_color($aksrt_bg_settings['page_bg_color']);
|
|
}
|
|
if (!empty($aksrt_bg_settings['page_bg_image'])) {
|
|
$aksrt_bg_styles[] = '--aksrt-page-bg-image:url(' . esc_url($aksrt_bg_settings['page_bg_image']) . ')';
|
|
}
|
|
if (!empty($aksrt_bg_styles)) {
|
|
$aksrt_body_classes[] = 'aksrt-bg-body';
|
|
if (!empty($aksrt_bg_settings['bg_overlay'])) {
|
|
$aksrt_body_classes[] = 'aksrt-bg-overlay';
|
|
}
|
|
}
|
|
?><!DOCTYPE html>
|
|
<html lang="<?php echo esc_attr(str_replace('_', '-', get_bloginfo('language'))); ?>"<?php echo $aksrt_initial_theme_mode === 'dark' ? ' class="dark"' : ''; ?><?php echo $aksrt_has_initial_theme ? ' data-theme="' . esc_attr($aksrt_initial_theme_mode) . '"' : ''; ?>>
|
|
<head>
|
|
<meta charset="<?php bloginfo('charset'); ?>">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0, viewport-fit=cover">
|
|
<?php wp_head(); ?>
|
|
</head>
|
|
<body <?php body_class($aksrt_body_classes); ?><?php echo !empty($aksrt_bg_styles) ? ' style="' . esc_attr(implode(';', $aksrt_bg_styles)) . '"' : ''; ?><?php echo $aksrt_has_initial_theme ? ' data-theme="' . esc_attr($aksrt_initial_theme_mode) . '"' : ''; ?>>
|
|
<?php wp_body_open(); ?>
|
|
|
|
<div id="aksrt-bg-vars" hidden <?php echo !empty($aksrt_bg_styles) ? 'style="' . esc_attr(implode(';', $aksrt_bg_styles)) . '"' : ''; ?>></div>
|
|
|
|
<?php
|
|
if (function_exists('aksrt_header')) {
|
|
aksrt_header();
|
|
}
|
|
|
|
// Zibll: header slider after </header> (+ mobile drawer), before page fluid/main.
|
|
if (function_exists('aksrt_header_slide')) {
|
|
aksrt_header_slide();
|
|
}
|
|
?>
|