Files
wordpress-theme-aksrt/templates/pages/page-user-home.php
T
kate522 50e9e83f68 fix(user-home): 1:1 align public profile with Zibll author page
- Remove 主页概览/快捷入口/交易服务 private-dashboard sidebar from public home
- Full-width layout; counts live in tab bar (粉丝 = followers)
- Hero: 用户中心/消息 for self, 关注/私信 for others; drop body stats row
- Defaults: no sidebar, posts/favorites/comments/follow tabs
2026-07-15 16:18:17 +08:00

78 lines
2.6 KiB
PHP

<?php
/**
* Public user homepage template.
*
* Thin shell: resolve user → build context → mount parts.
* Layout matches Zibll author.php: full-width header + tabs (no commerce sidebar).
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
get_header();
$target_user_nicename = get_query_var('user_nicename');
$user = $target_user_nicename ? get_user_by('slug', $target_user_nicename) : null;
if (!$user instanceof WP_User) {
wp_safe_redirect(home_url('/'));
exit;
}
if (!function_exists('aksrt_get_user_home_page_context')) {
require_once AKSRT_DIR . '/inc/helpers/aksrt-user-home.php';
}
$ctx = aksrt_get_user_home_page_context($user);
extract($ctx, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
require_once AKSRT_DIR . '/templates/parts/user-shared-helpers.php';
?>
<main id="main-content" class="site-main container content-shell content-shell--stream aksrt-user-home" tabindex="-1">
<div class="content-wrap">
<div class="content-layout content-layout--no-sidebar aksrt-user-home__layout">
<div class="content-layout__primary">
<?php
get_template_part('templates/parts/user/author-hero', null, [
'user' => $user,
'dashboard' => $dashboard,
'user_home_settings' => $user_home_settings,
'is_author_page' => false,
'tab_counts' => $tab_counts ?? [],
]);
?>
<div class="dashboard dashboard--public" data-default-tab="<?php echo esc_attr($default_tab); ?>">
<div class="dashboard-tabs" role="tablist">
<?php foreach ($enabled_tabs as $tab_key) :
$tab_class = $tab_key === $active_tab ? 'is-active' : '';
if (in_array($tab_key, $tabs_pc_hide, true)) {
$tab_class .= ' tab-hide-pc';
}
if (in_array($tab_key, $tabs_mobile_hide, true)) {
$tab_class .= ' tab-hide-mobile';
}
$tab_count = (int) ($tab_counts[$tab_key] ?? 0);
?>
<button type="button" class="<?php echo esc_attr(trim($tab_class)); ?>" data-tab="<?php echo esc_attr($tab_key); ?>" role="tab">
<?php echo esc_html($tab_labels[$tab_key] ?? ucfirst($tab_key)); ?>
<span class="dashboard-tabs__count opacity8"><?php echo esc_html((string) $tab_count); ?></span>
</button>
<?php endforeach; ?>
</div>
<?php
get_template_part('templates/parts/user-home/panels', 'core', $ctx);
get_template_part('templates/parts/user-home/panel', 'forum', $ctx);
get_template_part('templates/parts/user-home/panel', 'follow', $ctx);
?>
</div>
</div>
</div>
</div>
</main>
<?php get_footer(); ?>