feat(frontend): deepen single post 1:1 parity with Zibll
Split related style/source settings, add subtitle/meta/allow-view helpers, align cover/author/tags/pay shell markup and CSS with Zibll single.
This commit is contained in:
1 parent
72ea0828bc
commit
48f7436030
14 files changed
+2156
-1434
No files matched your search
@@ -3,6 +3,12 @@
|
||||
* Shared author info bar for single post content (Zibll article-avatar / user-info).
|
||||
*
|
||||
* Contract: get_template_part(..., null, $args)
|
||||
* show_actions bool Follow / PM buttons + meta row
|
||||
* show_bio bool Append bio after time
|
||||
* show_time bool Relative publish/update time (default true)
|
||||
* meta_html string Prebuilt Zibll single-metabox HTML
|
||||
* meta_items array Legacy text meta items (fallback)
|
||||
* extra_class string
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
@@ -13,6 +19,8 @@ $args = is_array($args ?? null) ? $args : [];
|
||||
$extra_class = (string) ($args['extra_class'] ?? '');
|
||||
$show_actions = !empty($args['show_actions']);
|
||||
$show_bio = !empty($args['show_bio']);
|
||||
$show_time = !array_key_exists('show_time', $args) || !empty($args['show_time']);
|
||||
$meta_html = (string) ($args['meta_html'] ?? '');
|
||||
$meta_items = is_array($args['meta_items'] ?? null) ? array_values(array_filter($args['meta_items'], static function ($meta_item) {
|
||||
if (is_array($meta_item)) {
|
||||
return !empty($meta_item['text']);
|
||||
@@ -39,18 +47,44 @@ $aksrt_pm_on = class_exists('AKSRT_Settings') && !empty(AKSRT_Settings::private_
|
||||
$aksrt_msg_url = function_exists('aksrt_get_messages_page_url') ? aksrt_get_messages_page_url() : '';
|
||||
$login_url = function_exists('aksrt_get_login_url') ? aksrt_get_login_url() : wp_login_url(get_permalink());
|
||||
$is_self = is_user_logged_in() && get_current_user_id() === $author_id;
|
||||
|
||||
// Identity chips: VIP + verify/level/badges.
|
||||
$vip_badge = function_exists('aksrt_render_vip_badge') ? aksrt_render_vip_badge($author_id, 'sm') : '';
|
||||
$signals = [];
|
||||
if (class_exists('AKSRT_User_Home')) {
|
||||
$signals = AKSRT_User_Home::get_instance()->get_profile_signals($author_id);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="<?php echo esc_attr($classes); ?>">
|
||||
<div class="user-info flex ac">
|
||||
<a class="avatar-img" href="<?php echo esc_url($author_url); ?>">
|
||||
<?php echo get_avatar($author_id, 52, '', esc_attr($author_name), ['class' => 'avatar avatar-id-' . $author_id]); ?>
|
||||
</a>
|
||||
<?php if (function_exists('aksrt_get_avatar_html')) : ?>
|
||||
<a class="avatar-img" href="<?php echo esc_url($author_url); ?>">
|
||||
<?php echo aksrt_get_avatar_html($author_id, 52, ['class' => 'avatar avatar-id-' . $author_id]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<a class="avatar-img" href="<?php echo esc_url($author_url); ?>">
|
||||
<?php echo get_avatar($author_id, 52, '', esc_attr($author_name), ['class' => 'avatar avatar-id-' . $author_id]); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<div class="user-right flex flex1 ac jsb ml10">
|
||||
<div class="flex1">
|
||||
<a class="display-name text-ellipsis" href="<?php echo esc_url($author_url); ?>"><?php echo esc_html($author_name); ?></a>
|
||||
<name class="flex ac flex1">
|
||||
<a class="display-name text-ellipsis" href="<?php echo esc_url($author_url); ?>"><?php echo esc_html($author_name); ?></a>
|
||||
<?php if ($vip_badge !== '') : ?>
|
||||
<?php echo $vip_badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($signals as $signal) : ?>
|
||||
<span class="badg badg-sm ml3 aksrt-identity-chip aksrt-identity-chip--<?php echo esc_attr((string) ($signal['tone'] ?? 'info')); ?>">
|
||||
<i class="fa fa-<?php echo esc_attr((string) ($signal['icon'] ?? 'check')); ?>" aria-hidden="true"></i>
|
||||
<?php echo esc_html((string) ($signal['label'] ?? '')); ?>
|
||||
</span>
|
||||
<?php endforeach; ?>
|
||||
</name>
|
||||
<div class="px12-sm muted-2-color text-ellipsis">
|
||||
<span class="icon-circle" title="<?php echo esc_attr($abs_fmt); ?>" data-toggle="tooltip"><?php echo esc_html($time_text); ?></span>
|
||||
<?php if ($show_time) : ?>
|
||||
<span class="icon-circle" title="<?php echo esc_attr($abs_fmt); ?>" data-toggle="tooltip"><?php echo esc_html($time_text); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ($show_bio) : ?>
|
||||
<?php $bio = trim((string) get_the_author_meta('description')); ?>
|
||||
<?php if ($bio !== '') : ?>
|
||||
@@ -85,7 +119,9 @@ $is_self = is_user_logged_in() && get_current_user_id() === $author_id;
|
||||
<?php if ($show_actions) : ?>
|
||||
<div class="relative">
|
||||
<i class="line-form-line" aria-hidden="true"></i>
|
||||
<?php if (!empty($meta_items)) : ?>
|
||||
<?php if ($meta_html !== '') : ?>
|
||||
<?php echo $meta_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php elseif (!empty($meta_items)) : ?>
|
||||
<div class="flex ac single-metabox abs-right">
|
||||
<div class="post-metas">
|
||||
<?php foreach ($meta_items as $meta_item) : ?>
|
||||
@@ -99,34 +135,6 @@ $is_self = is_user_logged_in() && get_current_user_id() === $author_id;
|
||||
<item class="meta-view"><?php if ($meta_icon !== '') : ?><i class="<?php echo esc_attr($meta_icon); ?>" aria-hidden="true"></i> <?php endif; ?><?php echo esc_html($meta_text); ?></item>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="clearfix ml6 post-drop-meta">
|
||||
<button type="button" class="but cir post-drop-meta__toggle" aria-haspopup="true" aria-expanded="false" aria-label="<?php esc_attr_e('更多', 'aksrt'); ?>">
|
||||
<i class="fa fa-ellipsis-h" aria-hidden="true"></i>
|
||||
</button>
|
||||
<div class="post-drop-meta__menu" aria-hidden="true">
|
||||
<?php if (current_user_can('edit_post', get_the_ID())) : ?>
|
||||
<a href="<?php echo esc_url(get_edit_post_link(get_the_ID())); ?>" class="post-drop-meta__item">
|
||||
<i class="fa fa-edit" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('编辑文章', 'aksrt'); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<button type="button" class="post-drop-meta__item" data-share-copy data-share-url="<?php echo esc_url(get_permalink()); ?>">
|
||||
<i class="fa fa-link" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('复制链接', 'aksrt'); ?></span>
|
||||
</button>
|
||||
<?php if (is_user_logged_in()) : ?>
|
||||
<button type="button" class="post-drop-meta__item" data-aksrt-report='{"target_type":"post","target_id":<?php echo (int) get_the_ID(); ?>}'>
|
||||
<i class="fa fa-flag" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('举报', 'aksrt'); ?></span>
|
||||
</button>
|
||||
<?php else : ?>
|
||||
<a href="<?php echo esc_url($login_url); ?>" class="post-drop-meta__item">
|
||||
<i class="fa fa-flag" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e('登录后举报', 'aksrt'); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user