Files
wordpress-theme-aksrt/inc/helpers/user-center-renderers/sidebar-stats.php
T
kate522andClaude Fable 5 c152e00501 fix(user-center): 1:1 port reference sidebar statistics row and icon box line-height
- Rewrite sidebar stats as a single zib-widget row (user-statistics-item, em14 / em09 opacity5 mt6), drop legacy .uc-stats styles
- Restore reference body line-height (1.42857143) on stats and service/settings boxes
- Move 我的订单 to the front of 我的服务 to match reference order

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 22:48:54 +08:00

43 lines
1.7 KiB
PHP

<?php
/**
* User center sidebar: one-line account statistics.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
$stats = [
[
'label' => __('文章', 'aksrt'),
'value' => (int) ($post_count ?? 0),
'url' => aksrt_get_user_center_tab_url('posts'),
'tab' => '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'),
'value' => (int) ($follower_count ?? 0),
'url' => aksrt_get_user_center_tab_url('follow'),
'tab' => 'follow',
],
];
?>
<?php // 1:1 参考主题 zib_user_center_page_sidebar_statistics():单张 zib-widget,四项 space-around 平铺。 ?>
<div class="uc-sidebar-statistics mb10-sm mb20 flex ac jsa zib-widget padding-10 text-center" aria-label="<?php esc_attr_e('账号统计', 'aksrt'); ?>">
<?php foreach ($stats as $stat) : ?>
<a class="user-statistics-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; ?>><div class="em14"><?php echo esc_html(aksrt_cut_count((int) $stat['value'])); ?></div><div class="em09 opacity5 mt6"><?php echo esc_html((string) $stat['label']); ?></div></a>
<?php endforeach; ?>
</div>