fix(frontend): restore homepage card grid

This commit is contained in:
2026-08-17 21:58:16 +08:00
parent 5d45eb053b
commit e745b2e54b
3 changed files with 54 additions and 12 deletions
+28 -7
View File
@@ -803,7 +803,6 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
if ($is_fixed_homepage) {
$enqueue_module('header-components'); // header-slider / hero
$enqueue_module('post-card');
$homepage_css_path = get_template_directory() . '/assets/css/frontend/homepage-fixed.css';
$homepage_style_deps = file_exists($frontend_bundle)
? ['aksrt-frontend-bundle', 'aksrt-header-components', 'aksrt-post-card']
: ['aksrt-zibll-compat-vars', 'aksrt-layout', 'aksrt-header-components', 'aksrt-post-card'];
@@ -811,12 +810,34 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
$homepage_style_deps,
static fn(string $handle): bool => wp_style_is($handle, 'registered')
));
wp_enqueue_style(
'aksrt-homepage-fixed',
$base_uri . '/assets/css/frontend/homepage-fixed.css',
$homepage_style_deps,
file_exists($homepage_css_path) ? (string) filemtime($homepage_css_path) : $version
);
// Enqueue split files directly so every leaf stylesheet receives its own
// cache version. A version on homepage-fixed.css cannot invalidate the
// unversioned nested @imports used by that legacy aggregate file.
$homepage_style_parts = [
'base-1',
'base-2',
'base-3',
'ajax-tab-skeleton-placeholder',
'ajax-tab-error-state',
];
$part_deps = $homepage_style_deps;
foreach ($homepage_style_parts as $part_index => $part_name) {
$is_last_part = $part_index === count($homepage_style_parts) - 1;
$part_handle = $is_last_part
? 'aksrt-homepage-fixed'
: 'aksrt-homepage-fixed-' . sanitize_key($part_name);
$part_relative_path = '/assets/css/frontend/homepage-fixed/' . $part_name . '.css';
$part_path = get_template_directory() . $part_relative_path;
wp_enqueue_style(
$part_handle,
$base_uri . $part_relative_path,
$part_deps,
file_exists($part_path) ? (string) filemtime($part_path) : $version
);
$part_deps = [$part_handle];
}
}
// 积分相关:已登录 + 启用积分功能时全站加载