From f34b982ac6bf95e30d2de10c636fc68360576800 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Jul 2026 11:22:50 +0800 Subject: [PATCH] feat(widgets): category-tabs REST mini list and ajax null Prefer shared mini list for category tab REST fallback and always return aksrt_get_ajax_null when the panel query is empty. --- src/AKSRT/Core/WidgetAjax.php | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/AKSRT/Core/WidgetAjax.php b/src/AKSRT/Core/WidgetAjax.php index 8e60cbbf..d1daa471 100644 --- a/src/AKSRT/Core/WidgetAjax.php +++ b/src/AKSRT/Core/WidgetAjax.php @@ -129,15 +129,31 @@ class WidgetAjax { if (function_exists('aksrt_home_widget_render_post_grid')) { aksrt_home_widget_render_post_grid($query, $layout, $columns, $context); } elseif ($query->have_posts()) { - echo ''; + } else { + echo function_exists('aksrt_get_ajax_null') + ? aksrt_get_ajax_null(__('暂无文章', 'aksrt')) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped + : '

' . esc_html__('暂无文章', 'aksrt') . '

'; } wp_reset_postdata(); - return new \WP_REST_Response(['success' => true, 'html' => (string) ob_get_clean()], 200); + $html = (string) ob_get_clean(); + if ($html === '') { + $html = function_exists('aksrt_get_ajax_null') + ? aksrt_get_ajax_null(__('暂无文章', 'aksrt')) + : '

' . esc_html__('暂无文章', 'aksrt') . '

'; + } + return new \WP_REST_Response(['success' => true, 'html' => $html], 200); } public function rest_hot_posts(\WP_REST_Request $request) {