进行了一些小修复
This commit is contained in:
1 parent
dc14c29878
commit
065a5bc99c
16 files changed
+3655
-2508
No files matched your search
@@ -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)) {
|
||||
|
||||
@@ -92,7 +92,7 @@ if (!function_exists('aksrt_footer_navbar_search')) :
|
||||
}
|
||||
|
||||
$remote = aksrt_get_remote_box([
|
||||
'type' => 'load',
|
||||
'type' => 'click',
|
||||
'class' => '',
|
||||
'loader' => '<div class="search-input"><p><i class="placeholder s1 mr6"></i><i class="placeholder s1 mr6"></i><i class="placeholder s1 mr6"></i></p><p class="placeholder k2"></p><p class="placeholder t1"></p><p><i class="placeholder s1 mr6"></i><i class="placeholder s1 mr6"></i><i class="placeholder s1 mr6"></i><i class="placeholder s1 mr6"></i></p><p class="placeholder k1"></p><p class="placeholder t1"></p><p></p><p class="placeholder k1" style="height:80px;"></p></div>',
|
||||
'query' => [
|
||||
@@ -110,20 +110,8 @@ if (!function_exists('aksrt_footer_navbar_search')) :
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_ajax_legacy_current_user_ping')) :
|
||||
/** Satisfy the reference runtime's one-shot user-state refresh request. */
|
||||
function aksrt_ajax_legacy_current_user_ping(): void {
|
||||
wp_send_json_success([
|
||||
'logged_in' => is_user_logged_in(),
|
||||
'user_id' => get_current_user_id(),
|
||||
]);
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action('wp_ajax_menu_search', 'aksrt_ajax_menu_search');
|
||||
add_action('wp_ajax_nopriv_menu_search', 'aksrt_ajax_menu_search');
|
||||
add_action('wp_ajax_search_box', 'aksrt_ajax_search_box');
|
||||
add_action('wp_ajax_nopriv_search_box', 'aksrt_ajax_search_box');
|
||||
add_action('wp_ajax_get_current_user', 'aksrt_ajax_legacy_current_user_ping');
|
||||
add_action('wp_ajax_nopriv_get_current_user', 'aksrt_ajax_legacy_current_user_ping');
|
||||
add_action('wp_footer', 'aksrt_footer_navbar_search', 10);
|
||||
Reference in new issue
Block a user