用户主页/作者页对齐 content-shell 与 author-hero 契约
去掉 author-hero query-var 传参,统一 content-wrap 壳层, 作者页侧栏改为 page-owned,不再 patch generic sidebar。
This commit is contained in:
@@ -2,39 +2,42 @@
|
||||
/**
|
||||
* Author Hero — shared hero section for author archive and public user homepage.
|
||||
*
|
||||
* Expected variables (passed via get_template_part or set_query_var):
|
||||
* $user (WP_User) Target user object.
|
||||
* $dashboard (array) Data from aksrt_get_user_dashboard_view().
|
||||
* $user_home_settings (array) User home display settings.
|
||||
* $is_author_page (bool) True when rendering on author.php (archive context).
|
||||
* Contract: get_template_part(..., null, $args)
|
||||
* user WP_User
|
||||
* dashboard array from aksrt_get_user_dashboard_view()
|
||||
* user_home_settings array
|
||||
* is_author_page bool
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (empty($user) || !($user instanceof WP_User)) {
|
||||
return;
|
||||
$args = is_array($args ?? null) ? $args : [];
|
||||
$user = $args['user'] ?? null;
|
||||
$dashboard = is_array($args['dashboard'] ?? null) ? $args['dashboard'] : [];
|
||||
$settings = is_array($args['user_home_settings'] ?? null) ? $args['user_home_settings'] : [];
|
||||
$is_author = !empty($args['is_author_page']);
|
||||
|
||||
if (!($user instanceof WP_User)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user_id = (int) $user->ID;
|
||||
$dashboard = $dashboard ?? [];
|
||||
$settings = $user_home_settings ?? [];
|
||||
$is_author = !empty($is_author_page);
|
||||
$home_url = function_exists('aksrt_get_user_home_url') ? aksrt_get_user_home_url($user) : home_url('/');
|
||||
$show_cover = !empty($settings['cover']);
|
||||
$show_follow = !empty($settings['follow']);
|
||||
$user_id = (int) $user->ID;
|
||||
$home_url = function_exists('aksrt_get_user_home_url') ? aksrt_get_user_home_url($user) : home_url('/');
|
||||
$show_cover = !empty($settings['cover']);
|
||||
$show_follow = !empty($settings['follow']);
|
||||
|
||||
$post_count = (int) ($dashboard['post_count'] ?? 0);
|
||||
$comment_count = (int) ($dashboard['comment_count'] ?? 0);
|
||||
$post_count = (int) ($dashboard['post_count'] ?? 0);
|
||||
$comment_count = (int) ($dashboard['comment_count'] ?? 0);
|
||||
$favorite_count = (int) ($dashboard['favorite_count'] ?? 0);
|
||||
$contacts = $dashboard['user_contacts'] ?? [];
|
||||
$social_on = !empty($dashboard['social_links_on']);
|
||||
$signals = $dashboard['profile_signals'] ?? [];
|
||||
$notice = $dashboard['profile_notice'] ?? null;
|
||||
$show_report = !empty($dashboard['show_report']);
|
||||
$bg_url = $dashboard['background_url'] ?? '';
|
||||
$is_own = !empty($dashboard['is_own_profile']);
|
||||
$contacts = $dashboard['user_contacts'] ?? [];
|
||||
$social_on = !empty($dashboard['social_links_on']);
|
||||
$signals = $dashboard['profile_signals'] ?? [];
|
||||
$notice = $dashboard['profile_notice'] ?? null;
|
||||
$show_report = !empty($dashboard['show_report']);
|
||||
$bg_url = $dashboard['background_url'] ?? '';
|
||||
$is_own = !empty($dashboard['is_own_profile']);
|
||||
?>
|
||||
|
||||
<div class="aksrt-author-hero<?php echo $show_cover ? '' : ' aksrt-author-hero--no-cover'; ?>">
|
||||
|
||||
Reference in New Issue
Block a user