feat(frontend): illustrated null states and author rewards fallback

Add aksrt_get_null / widget null helpers with null.svg, use them in
sidebar widgets, comments empty, and related posts; when PM is off show
post rewards entry on the single author bar.
This commit is contained in:
2026-07-16 19:33:57 +08:00
parent b1731f7a8d
commit a0748c08fe
10 changed files with 140 additions and 9 deletions
@@ -189,7 +189,7 @@ if (!function_exists('aksrt_home_widget_render_post_grid')) {
*/
function aksrt_home_widget_render_post_grid(WP_Query $query, string $layout = 'card', int $columns = 3, string $context = 'homepage'): void {
if (!$query->have_posts()) {
echo '<p class="widget-empty">' . esc_html__('暂无内容', 'aksrt') . '</p>';
echo function_exists('aksrt_get_widget_null') ? aksrt_get_widget_null(__('暂无内容', 'aksrt')) : '<p class="widget-empty">' . esc_html__('暂无内容', 'aksrt') . '</p>';
wp_reset_postdata();
return;
}
@@ -464,7 +464,7 @@ class AKSRT_Category_Tabs_Widget extends WP_Widget {
echo '<section class="aksrt-home-widget aksrt-home-widget--tabs widget-tab-posts">';
if (empty($tabs)) {
echo '<p class="widget-empty">' . esc_html__('暂无可用分类', 'aksrt') . '</p>';
echo function_exists('aksrt_get_widget_null') ? aksrt_get_widget_null(__('暂无可用分类', 'aksrt')) : '<p class="widget-empty">' . esc_html__('暂无可用分类', 'aksrt') . '</p>';
echo '</section>';
echo $args['after_widget'];
return;
@@ -649,7 +649,7 @@ class AKSRT_Category_Recommend_Widget extends WP_Widget {
aksrt_home_widget_render_header($title);
if (empty($cards)) {
echo '<p class="widget-empty">' . esc_html__('暂无推荐分类', 'aksrt') . '</p>';
echo function_exists('aksrt_get_widget_null') ? aksrt_get_widget_null(__('暂无推荐分类', 'aksrt')) : '<p class="widget-empty">' . esc_html__('暂无推荐分类', 'aksrt') . '</p>';
echo '</section>';
echo $args['after_widget'];
return;