进行了一些小修复

This commit is contained in:
kate522 committed 2026-08-26 12:35:20 +08:00
1 parent dc14c29878
commit 065a5bc99c
16 files changed
+3655 -2508

No files matched your search

+24
View File
@@ -165,6 +165,30 @@ add_action('enqueue_block_editor_assets', function () {
add_action('enqueue_block_assets', function () {
if (is_admin()) return; // Already loaded in editor
$posts = [];
$queried = get_queried_object();
if ($queried instanceof \WP_Post) {
$posts[$queried->ID] = $queried;
}
global $wp_query;
if ($wp_query instanceof \WP_Query) {
foreach ((array) $wp_query->posts as $post) {
if ($post instanceof \WP_Post) {
$posts[$post->ID] = $post;
}
}
}
$has_carousel = false;
foreach ($posts as $post) {
if (has_block('aksrt/carousel', $post)) {
$has_carousel = true;
break;
}
}
if (!$has_carousel) return;
$base_uri = get_template_directory_uri();
$blocks_css = get_template_directory() . '/assets/css/gutenberg-blocks.css';
if (file_exists($blocks_css)) {