fix(user-home): match reference cover metas with 人气值/点赞 pills
The public user homepage cover showed a single bottom-right 粉丝 pill, which the reference theme does not render there — it shows 人气值 and 点赞 as a translucent pill group pinned to the cover's top-right corner. - Cover metas: replace 粉丝 with 人气值 (zibsvg-hot) + 点赞 (zibsvg-like), summed over the user's published posts via aksrt_get_user_posts_meta_sum() and abbreviated with aksrt_cut_count(); each is zero-suppressed independently, matching zib_get_author_header_metas() - Titles use the reference strings 人气值 N / 获得N个点赞 via data-toggle="tooltip" - CSS: adopt .single-metabox.cover-meta semantics (one rgba(0,0,0,.3) pill at right:1em/top:1.6em, 14px, 6px item gaps, 3px icon margins) plus the reference's <=480px override; drop the per-stat bottom-right pills - Drop the dead __stats / __stat / __contacts CSS blocks and the unused $tab_counts hero contract arg Follower counts remain in the content tab bar (tab_counts['follow']). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -42,32 +42,33 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Cover meta pills — legacy .single-metabox.cover-meta parity:
|
||||||
|
* 单个胶囊容器贴封面右上角,内含 人气值 / 点赞 计数值。 */
|
||||||
.aksrt-author-hero__cover-metas {
|
.aksrt-author-hero__cover-metas {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 58px;
|
right: 1em;
|
||||||
bottom: 12px;
|
top: 1.6em;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
display: flex;
|
display: inline-flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
padding: 2px 6px;
|
||||||
|
border-radius: 100px;
|
||||||
|
background: rgba(0, 0, 0, 0.3);
|
||||||
|
color: rgba(255, 255, 255, 0.8);
|
||||||
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.aksrt-author-hero__cover-meta {
|
.aksrt-author-hero__cover-meta {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
margin: 0 6px;
|
||||||
padding: 4px 10px;
|
font-size: 13px;
|
||||||
border-radius: 999px;
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #fff;
|
|
||||||
background: rgba(0, 0, 0, 0.35);
|
|
||||||
backdrop-filter: blur(4px);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.aksrt-author-hero__cover-meta i {
|
.aksrt-author-hero__cover-meta .fa,
|
||||||
font-size: 11px;
|
.aksrt-author-hero__cover-meta .icon {
|
||||||
opacity: 0.9;
|
margin-right: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.aksrt-author-hero__body {
|
.aksrt-author-hero__body {
|
||||||
@@ -120,43 +121,7 @@
|
|||||||
max-width: 520px;
|
max-width: 520px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Body stats row removed for legacy author parity; counts live in tabs. */
|
/* Counts live in the tab bar, not a hero body stats row (legacy parity). */
|
||||||
.aksrt-author-hero__stats {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 10px;
|
|
||||||
margin-top: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-author-hero__stat {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
|
||||||
min-height: 34px;
|
|
||||||
padding: 0 14px;
|
|
||||||
border-radius: var(--radius-pill);
|
|
||||||
background: var(--surface-2);
|
|
||||||
color: var(--color-ink-3);
|
|
||||||
font-size: 13px;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-author-hero__stat strong {
|
|
||||||
color: var(--color-ink);
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-author-hero__contacts {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-author-hero__contacts .profile-social-links {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-author-hero__actions {
|
.aksrt-author-hero__actions {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -235,18 +200,6 @@
|
|||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.aksrt-author-hero__stats {
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-author-hero__contacts {
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-author-hero__contacts .profile-social-links {
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aksrt-author-hero__actions {
|
.aksrt-author-hero__actions {
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -258,6 +211,14 @@
|
|||||||
padding-bottom: calc(20% + 60px);
|
padding-bottom: calc(20% + 60px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aksrt-author-hero__cover-metas {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aksrt-author-hero__cover-meta {
|
||||||
|
margin: 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.aksrt-author-hero__body {
|
.aksrt-author-hero__body {
|
||||||
margin-top: -40px;
|
margin-top: -40px;
|
||||||
gap: 14px;
|
gap: 14px;
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ require_once AKSRT_DIR . '/templates/parts/user-shared-helpers.php';
|
|||||||
'dashboard' => $dashboard,
|
'dashboard' => $dashboard,
|
||||||
'user_home_settings' => $user_home_settings,
|
'user_home_settings' => $user_home_settings,
|
||||||
'is_author_page' => false,
|
'is_author_page' => false,
|
||||||
'tab_counts' => $tab_counts ?? [],
|
|
||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
* Author Hero — shared hero section for author archive and public user homepage.
|
* Author Hero — shared hero section for author archive and public user homepage.
|
||||||
*
|
*
|
||||||
* Aligns with legacy(): cover, avatar, name, identity, desc,
|
* Aligns with legacy(): cover, avatar, name, identity, desc,
|
||||||
* and header actions. Content stats live in the tab bar, not a body stats row.
|
* and header actions. The cover carries the 人气值 / 点赞 meta pills
|
||||||
|
* (legacy zib_get_author_header_metas); follower counts stay in the tab bar.
|
||||||
*
|
*
|
||||||
* Contract: get_template_part(..., null, $args)
|
* Contract: get_template_part(..., null, $args)
|
||||||
* user WP_User
|
* user WP_User
|
||||||
* dashboard array from aksrt_get_user_dashboard_view()
|
* dashboard array from aksrt_get_user_dashboard_view()
|
||||||
* user_home_settings array
|
* user_home_settings array
|
||||||
* is_author_page bool
|
* is_author_page bool
|
||||||
* tab_counts array (optional)
|
|
||||||
*
|
*
|
||||||
* @package AKSRT
|
* @package AKSRT
|
||||||
*/
|
*/
|
||||||
@@ -22,7 +22,6 @@ $user = $args['user'] ?? null;
|
|||||||
$dashboard = is_array($args['dashboard'] ?? null) ? $args['dashboard'] : [];
|
$dashboard = is_array($args['dashboard'] ?? null) ? $args['dashboard'] : [];
|
||||||
$settings = is_array($args['user_home_settings'] ?? null) ? $args['user_home_settings'] : [];
|
$settings = is_array($args['user_home_settings'] ?? null) ? $args['user_home_settings'] : [];
|
||||||
$is_author = !empty($args['is_author_page']);
|
$is_author = !empty($args['is_author_page']);
|
||||||
$tab_counts = is_array($args['tab_counts'] ?? null) ? $args['tab_counts'] : [];
|
|
||||||
|
|
||||||
if (!($user instanceof WP_User)) {
|
if (!($user instanceof WP_User)) {
|
||||||
return;
|
return;
|
||||||
@@ -48,9 +47,26 @@ $show_report = !empty($dashboard['show_report']);
|
|||||||
$bg_url = function_exists('aksrt_get_user_cover_url') ? aksrt_get_user_cover_url($user_id) : '';
|
$bg_url = function_exists('aksrt_get_user_cover_url') ? aksrt_get_user_cover_url($user_id) : '';
|
||||||
$is_own = !empty($dashboard['is_own_profile']);
|
$is_own = !empty($dashboard['is_own_profile']);
|
||||||
|
|
||||||
$follower_count = (int) ($tab_counts['follow'] ?? 0);
|
// 封面右上角数据条(参考主题 zib_get_author_header_metas):人气值 + 点赞,
|
||||||
if ($follower_count <= 0 && class_exists('\AKSRT\User\Follow')) {
|
// 粉丝数只在内容 tab 上呈现,不进入封面。
|
||||||
$follower_count = (int) \AKSRT\User\Follow::get_instance()->get_follower_count($user_id);
|
$cover_metas = [];
|
||||||
|
if (function_exists('aksrt_get_user_posts_meta_sum') && function_exists('aksrt_cut_count')) {
|
||||||
|
$view_n = aksrt_cut_count(aksrt_get_user_posts_meta_sum($user_id, 'aksrt_post_views'));
|
||||||
|
$like_n = aksrt_cut_count(aksrt_get_user_posts_meta_sum($user_id, '_aksrt_like_count'));
|
||||||
|
if ($view_n !== '' && $view_n !== '0') {
|
||||||
|
$cover_metas[] = [
|
||||||
|
'count' => $view_n,
|
||||||
|
'title' => sprintf(__('人气值 %s', 'aksrt'), $view_n),
|
||||||
|
'icon' => 'zibsvg-hot',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if ($like_n !== '' && $like_n !== '0') {
|
||||||
|
$cover_metas[] = [
|
||||||
|
'count' => $like_n,
|
||||||
|
'title' => sprintf(__('获得%s个点赞', 'aksrt'), $like_n),
|
||||||
|
'icon' => 'zibsvg-like',
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$notification_settings = class_exists('\AKSRT\Settings\Settings')
|
$notification_settings = class_exists('\AKSRT\Settings\Settings')
|
||||||
@@ -74,12 +90,14 @@ $show_cover_menu = $has_more_details || $show_cover_report || $cover_ban_html !=
|
|||||||
<div class="aksrt-author-hero__cover">
|
<div class="aksrt-author-hero__cover">
|
||||||
<img<?php echo aksrt_get_lazy_attr('lazy_cover', (string) $bg_url, 'aksrt-author-hero__cover-img', aksrt_get_lazy_thumb('lg')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> alt="">
|
<img<?php echo aksrt_get_lazy_attr('lazy_cover', (string) $bg_url, 'aksrt-author-hero__cover-img', aksrt_get_lazy_thumb('lg')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> alt="">
|
||||||
<div class="aksrt-author-hero__cover-mask"></div>
|
<div class="aksrt-author-hero__cover-mask"></div>
|
||||||
<?php if ($follower_count > 0) : ?>
|
<?php if ($cover_metas) : ?>
|
||||||
<div class="aksrt-author-hero__cover-metas" aria-label="<?php esc_attr_e('主页数据', 'aksrt'); ?>">
|
<div class="aksrt-author-hero__cover-metas" aria-label="<?php esc_attr_e('主页数据', 'aksrt'); ?>">
|
||||||
<span class="aksrt-author-hero__cover-meta" title="<?php esc_attr_e('粉丝', 'aksrt'); ?>">
|
<?php foreach ($cover_metas as $cover_meta) : ?>
|
||||||
<i class="fa fas fa-heart" aria-hidden="true"></i>
|
<span class="aksrt-author-hero__cover-meta" data-toggle="tooltip" title="<?php echo esc_attr((string) $cover_meta['title']); ?>">
|
||||||
<?php echo esc_html((string) $follower_count); ?>
|
<?php echo aksrt_icon_markup((string) $cover_meta['icon']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
|
||||||
</span>
|
<?php echo esc_html((string) $cover_meta['count']); ?>
|
||||||
|
</span>
|
||||||
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($show_cover_menu) : ?>
|
<?php if ($show_cover_menu) : ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user