feat(navigation): hard-switch to Zibll navigation and Font Awesome 5

This commit is contained in:
2026-08-18 20:46:21 +08:00
parent 3c3ddac8be
commit a0b84977a2
630 changed files with 101647 additions and 11293 deletions
+32 -56
View File
@@ -20,22 +20,21 @@ if (!function_exists('aksrt_get_header_nav_context')) :
}
$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',
'nav_pay_vip' => true,
'nav_user_pay_vip' => true,
];
? \AKSRT\Settings\Settings::get_all()
: [];
$layout = sanitize_key((string) ($settings['header_layout'] ?? '1'));
if (!in_array($layout, ['1', '2', '3'], true)) {
$layout = '1';
}
$mobile_layout = sanitize_key((string) ($settings['mobile_header_layout'] ?? 'center'));
if (!in_array($mobile_layout, ['center', 'left'], true)) {
$mobile_layout = 'center';
}
$mobile_align = sanitize_key((string) ($settings['mobile_navbar_align'] ?? 'left'));
if (!in_array($mobile_align, ['top', 'left', 'right'], true)) {
$mobile_align = 'left';
}
$nav_fixed = !isset($settings['nav_fixed']) || !empty($settings['nav_fixed']);
$site_name = get_bloginfo('name');
$brand_name = function_exists('aksrt_get_site_logo_text') ? aksrt_get_site_logo_text() : $site_name;
@@ -57,7 +56,7 @@ if (!function_exists('aksrt_get_header_nav_context')) :
? \AKSRT\Settings\Settings::get_theme_mode_button_positions()
: ['pc_nav', 'm_menu'];
$can_publish = !empty($settings['publish_btn']) && (
$can_publish = (!isset($settings['nav_newposts']) || !empty($settings['nav_newposts'])) && (
current_user_can('manage_options')
|| (class_exists('\AKSRT\Core\FrontSubmit') && \AKSRT\Core\FrontSubmit::get_instance()->can_submit())
);
@@ -75,17 +74,13 @@ if (!function_exists('aksrt_get_header_nav_context')) :
$ctx = [
'settings' => $settings,
'layout' => (string) ($settings['layout'] ?? '1'),
'mobile_layout' => (string) ($settings['mobile_layout'] ?? 'center'),
'mobile_align' => (string) ($settings['mobile_align'] ?? 'left'),
'fixed' => !empty($settings['fixed']),
'scroll_down_hide' => !empty($settings['scroll_down_hide']) && !empty($settings['fixed']),
'search_enabled' => !empty($settings['search_enabled']),
'user_menu' => !empty($settings['user_menu']),
'mobile_drawer' => !empty($settings['mobile_drawer']),
'layout' => $layout,
'mobile_layout' => $mobile_layout,
'mobile_align' => $mobile_align,
'fixed' => $nav_fixed,
'scroll_down_hide' => (!isset($settings['nav_scroll_down_hide']) || !empty($settings['nav_scroll_down_hide'])) && $nav_fixed,
'nav_pay_vip' => !isset($settings['nav_pay_vip']) || !empty($settings['nav_pay_vip']),
'nav_user_pay_vip' => !isset($settings['nav_user_pay_vip']) || !empty($settings['nav_user_pay_vip']),
'max_width' => (int) ($settings['max_width'] ?? 1200),
'brand_name' => $brand_name,
'logo_html' => $logo_html,
'has_logo' => $logo_html !== '',
@@ -148,35 +143,22 @@ if (!function_exists('aksrt_header')) :
}
$nav_class = [
'navbar',
'navbar-top',
$ctx['mobile_layout'],
];
$style_key = sanitize_key((string) ($ctx['settings']['nav_style'] ?? 'default'));
if (in_array($style_key, ['transparent', 'blur'], true)) {
$header_class[] = 'nav-style-' . $style_key;
$nav_class[] = 'nav-style-' . $style_key;
}
$nav_style = '';
if ((int) $ctx['max_width'] > 0) {
$nav_style = ' style="--nav-max-width:' . (int) $ctx['max_width'] . 'px"';
}
'navbar',
'navbar-top',
$ctx['mobile_layout'],
];
echo '<header class="' . esc_attr(implode(' ', array_map('sanitize_html_class', $header_class))) . '">';
echo '<nav class="' . esc_attr(implode(' ', array_map('sanitize_html_class', $nav_class))) . '"' . $nav_style . '>';
echo '<nav class="' . esc_attr(implode(' ', array_map('sanitize_html_class', $nav_class))) . '">';
echo '<div class="container-fluid container-header">';
aksrt_navbar_header($ctx);
// Do NOT use Bootstrap's `.collapse` here — BS5 hides `.collapse:not(.show)`
// which would wipe the whole PC top bar (menu / CTA / user / search).
// Zibll uses a plain `.navbar-collapse` flex row; mobile uses the drawer.
echo '<div class="navbar-collapse">';
echo '<div class="collapse navbar-collapse">';
if ('3' !== $layout) {
aksrt_menu_items('primary', true);
}
if ('2' === $layout && !empty($ctx['search_enabled'])) {
if ('2' === $layout) {
aksrt_get_menu_search($ctx);
}
aksrt_menu_button($ctx);
@@ -187,17 +169,11 @@ $nav_style = '';
}
echo '</div></div></nav></header>';
if (!empty($ctx['mobile_drawer'])) {
aksrt_nav_mobile_shell($ctx);
}
aksrt_nav_mobile_shell($ctx);
// Layout 1/3 search slide (zibll .navbar-search). Layout-2 uses inline menu_search.
if (!empty($ctx['search_enabled'])) {
$navbar_search = locate_template('templates/parts/navbar-search.php');
if ($navbar_search) {
include $navbar_search;
}
}
if (!empty($ctx['show_slide']) && function_exists('aksrt_header_slide')) {
aksrt_header_slide();
}
if (function_exists('aksrt_render_signout_modal')) {
aksrt_render_signout_modal();