Files
wordpress-theme-aksrt/header.php
T

68 lines
2.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::read_domain('page_display', 'header-nav')
: [];
$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;
?><!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 $aksrt_has_initial_theme ? ' data-theme="' . esc_attr($aksrt_initial_theme_mode) . '"' : ''; ?>>
<?php wp_body_open(); ?>
<?php
if (function_exists('aksrt_header')) {
aksrt_header();
}
\AKSRT\WidgetSystem\WidgetAreas::render('all_top_fluid', 'fluid-widget-wrap');
?>