103 lines
4.7 KiB
PHP
103 lines
4.7 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_all()
|
|
: [];
|
|
$aksrt_header_layout = sanitize_key((string) ($aksrt_header_settings['header_layout'] ?? '1'));
|
|
if (!in_array($aksrt_header_layout, ['1', '2', '3'], true)) {
|
|
$aksrt_header_layout = '1';
|
|
}
|
|
$aksrt_mobile_layout = sanitize_key((string) ($aksrt_header_settings['mobile_header_layout'] ?? 'center'));
|
|
if (!in_array($aksrt_mobile_layout, ['center', 'left'], true)) {
|
|
$aksrt_mobile_layout = 'center';
|
|
}
|
|
$aksrt_mobile_align = sanitize_key((string) ($aksrt_header_settings['mobile_navbar_align'] ?? 'left'));
|
|
if (!in_array($aksrt_mobile_align, ['top', 'left', 'right'], true)) {
|
|
$aksrt_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 (!isset($aksrt_header_settings['nav_fixed']) || !empty($aksrt_header_settings['nav_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';
|
|
}
|
|
$aksrt_body_classes[] = 'header-layout-' . $aksrt_header_layout;
|
|
$aksrt_body_classes[] = 'mobile-header-' . $aksrt_mobile_layout;
|
|
$aksrt_body_classes[] = 'mobile-nav-' . $aksrt_mobile_align;
|
|
|
|
// 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();
|
|
}
|
|
|
|
\AKSRT\WidgetSystem\WidgetAreas::render('all_top_fluid', 'fluid-widget-wrap');
|
|
?>
|