fix(homepage): align shell with zibll and restore post stream

Move header-slider outside main, render fluid zones once, default the
latest stream to plain posts by date, and cut dual-render/perf waste so
published posts and hero/banner structure match the zibll contract.
This commit is contained in:
kate522 committed 2026-07-12 17:49:58 +08:00
1 parent 8be4c5c123
commit 8f19384582
11 files changed
+223 -103

No files matched your search

+16 -4
View File
@@ -21,7 +21,19 @@ if (class_exists('AKSRT_Settings') && !AKSRT_Settings::homepage_module_banner_en
}
$banners = function_exists('aksrt_get_banners') ? aksrt_get_banners(8, 'banner') : [];
if (empty($banners)) return;
if (empty($banners)) {
if (current_user_can('manage_options')) {
echo '<div class="home-module home-module--banner home-module--banner-empty box-body">';
echo '<p class="muted-2-color">' . esc_html__('No Banner slides found. Add banner slides in admin.', 'aksrt') . '</p>';
if (function_exists('aksrt_render_admin_quick_link')) {
echo '<div class="home-module__admin-tools">';
aksrt_render_admin_quick_link('page-display/header-components', __('Header / Banner settings', 'aksrt'));
echo '</div>';
}
echo '</div>';
}
return;
}
$cfg = get_query_var('aksrt_module_config', []);
if (!is_array($cfg)) $cfg = [];
@@ -41,9 +53,9 @@ $swiper_config = [
'spaceBetween' => ($slider_cfg['space_between'] ?? 0),
];
?>
<div class="home-module home-module--banner">
<div class="banner-module">
<div class="swiper banner-module__swiper" data-swiper-config="<?php echo esc_attr(wp_json_encode($swiper_config)); ?>">
<div class="home-module home-module--banner slide-widget mb20">
<div class="banner-module zib-slider">
<div class="swiper new-swiper banner-module__swiper slide-widget-swiper" data-swiper-config="<?php echo esc_attr(wp_json_encode($swiper_config)); ?>">
<div class="swiper-wrapper">
<?php foreach ($banners as $index => $slide) :
$device_vis = $slide['device_visibility'] ?? 'all';
+9 -5
View File
@@ -45,7 +45,10 @@ $card_icon_shape = $settings['header_components_card_icon_shape'] ?? 'circle';
$slide_count = count($hero_banners);
$visible_card_count = ($show_cards && !empty($icon_cards)) ? count($icon_cards) : 0;
$container_classes = ['header-components-container', 'relative', 'card-' . $visible_card_count];
$container_classes = ['header-slider-container', 'header-components-container', 'relative', 'mb20', 'card-' . $visible_card_count];
if (in_array('pc', $filter_blur_devices, true) || in_array('mobile', $filter_blur_devices, true)) {
$container_classes[] = 'filter-blur';
}
if (in_array('pc', $filter_blur_devices, true)) {
$container_classes[] = 'has-blur-pc';
}
@@ -70,7 +73,7 @@ $render_hero_search = static function (string $search_id) use ($search_placehold
$_show_cat = !empty($search_cfg['show_input_cat']) && !empty($_cats);
$_show_type = !empty($search_cfg['show_type']) && !empty($_types);
?>
<div class="header-components-search">
<div class="header-slider-search header-components-search abs-center">
<div class="search-input">
<form role="search" method="get" action="<?php echo esc_url(home_url('/')); ?>" class="search-form" data-aksrt-search-form="hero">
<input type="hidden" name="aksrt_search_type" value="<?php echo esc_attr($search_type); ?>">
@@ -136,7 +139,7 @@ $render_icon_cards = static function () use ($show_cards, $icon_cards, $card_bg_
return;
}
?>
<div class="header-components-card">
<div class="header-slider-card header-components-card container">
<div class="header-components-card__container container">
<?php if ($card_bg_mode === 'shared') : ?>
<div class="header-components-card__wrap header-components-card__wrap--shared">
@@ -192,7 +195,7 @@ if (!empty($hero_banners)) :
}
?>
<div class="<?php echo esc_attr(implode(' ', $container_classes)); ?>" id="aksrt-header-components"<?php if ($height_style !== '') : ?> style="<?php echo $height_style; ?>"<?php endif; ?>>
<div class="swiper header-components slide-header" data-swiper-config="<?php echo esc_attr(wp_json_encode($swiper_config)); ?>">
<div class="relative zib-slider"><div class="swiper new-swiper header-components slide-index slide-header" data-swiper-config="<?php echo esc_attr(wp_json_encode($swiper_config)); ?>">
<div class="swiper-wrapper">
<?php foreach ($hero_banners as $index => $slide) :
$device_vis = $slide['device_visibility'] ?? 'all';
@@ -222,7 +225,7 @@ if (!empty($hero_banners)) :
<div class="<?php echo esc_attr($slide_classes); ?>"<?php if (!empty($slide['link'])) : ?> data-link="<?php echo esc_url($slide['link']); ?>" data-target="<?php echo esc_attr($link_target); ?>"<?php endif; ?>>
<div class="header-components__slide-bg">
<?php if (!empty($slide['video_url'])) : ?>
<video class="header-components__video" autoplay muted loop playsinline preload="auto">
<video class="header-components__video" autoplay muted loop playsinline preload="metadata">
<source src="<?php echo esc_url($slide['video_url']); ?>" type="video/mp4">
</video>
<?php endif; ?>
@@ -288,6 +291,7 @@ if (!empty($hero_banners)) :
<?php $render_hero_search('header-search-input'); ?>
<?php endif; ?>
</div>
</div>
<?php $render_icon_cards(); ?>
<?php if (function_exists('aksrt_render_admin_quick_link')) : ?>