fix(users): keep center navigation local and restore public home

This commit is contained in:
kate522 committed 2026-08-12 20:02:37 +08:00
1 parent 114321c4b1
commit c3bfd12c69
6 files changed
+45 -25

No files matched your search

@@ -13,16 +13,19 @@ $stats = [
'label' => __('文章', 'aksrt'),
'value' => (int) ($post_count ?? 0),
'url' => isset($dashboard_tabs['posts']) ? aksrt_get_user_center_tab_url('posts') : $public_home_url,
'tab' => isset($dashboard_tabs['posts']) ? 'posts' : '',
],
[
'label' => __('评论', 'aksrt'),
'value' => (int) ($comment_count ?? 0),
'url' => isset($dashboard_tabs['comments']) ? aksrt_get_user_center_tab_url('comments') : $public_home_url,
'tab' => isset($dashboard_tabs['comments']) ? 'comments' : '',
],
[
'label' => __('收藏', 'aksrt'),
'value' => (int) ($favorite_count ?? 0),
'url' => isset($dashboard_tabs['favorites']) ? aksrt_get_user_center_tab_url('favorites') : $public_home_url,
'tab' => isset($dashboard_tabs['favorites']) ? 'favorites' : '',
],
[
'label' => __('粉丝', 'aksrt'),
@@ -34,7 +37,7 @@ $stats = [
<div class="uc-sidebar__section uc-sidebar__section--stats" aria-label="<?php esc_attr_e('账号统计', 'aksrt'); ?>">
<div class="uc-stats">
<?php foreach ($stats as $stat) : ?>
<a class="uc-stats__item" href="<?php echo esc_url((string) $stat['url']); ?>">
<a class="uc-stats__item" href="<?php echo esc_url((string) $stat['url']); ?>"<?php if (!empty($stat['tab'])) : ?> data-tab="<?php echo esc_attr((string) $stat['tab']); ?>"<?php endif; ?>>
<span class="uc-stats__value"><?php echo esc_html(number_format_i18n((int) $stat['value'])); ?></span>
<span class="uc-stats__label"><?php echo esc_html((string) $stat['label']); ?></span>
</a>