Files
wordpress-theme-aksrt/templates/forum/forum-plate-cat.php
T
kate522andClaude Fable 5 fb68b3f8c6 feat: 收口 1:1 剩余欠账(论坛壳/圈子/501/私信默认/资源死码)
- 论坛 board/topic/plate/tag/plate-cat 接入 content-wrap/content-layout 主站流壳
- 公共主页 plate 圈子 tab 接关注/管理版块真实数据并计数
- forum-topic 渲染封面/付费扩展位 meta(§7.3)
- 后台删除消息/背景图/评论图 REST 从 501 补齐为真实实现
- 私信 private_s 缺省 true(完整 1:1,不再兼容默认关)
- 清理 aksrt_get_resource_meta 不可达旧实现;挂载 AKSRT_AI 配置门控实例
- 登录 modal 启用 colorful-header;订单页粉边 focus 软化;侧栏次级入口视觉弱化

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-12 13:06:47 +08:00

116 lines
5.0 KiB
PHP

<?php
/**
* Plate category (分区) archive template.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
get_header();
$forum = class_exists('AKSRT_Forum') ? AKSRT_Forum::get_instance() : null;
$term = get_queried_object();
$cat_id = $term ? (int) $term->term_id : 0;
$forum_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_forum_settings() : [];
$forum_names = $forum_settings['names'] ?? [];
$forum_name = $forum_names['forum'] ?? __('论坛', 'aksrt');
$plates = [];
if ($forum && $cat_id > 0) {
$plates = $forum->get_sorted_plates('menu_order', 'ASC', 100);
$plates = array_filter($plates, static function ($plate) use ($cat_id): bool {
return isset($plate['plate_cat']['id']) && (int) $plate['plate_cat']['id'] === $cat_id;
});
$plates = array_values($plates);
}
$cat_moderator_ids = get_term_meta($cat_id, '_aksrt_cat_moderator', true);
$cat_moderators = [];
if (is_array($cat_moderator_ids)) {
foreach ($cat_moderator_ids as $uid) {
$user = get_userdata((int) $uid);
if ($user) {
$cat_moderators[] = [
'id' => (int) $user->ID,
'name' => $user->display_name,
'avatar' => function_exists('aksrt_get_avatar_url') ? aksrt_get_avatar_url($user->ID, 36) : get_avatar_url($user->ID, ['size' => 36]),
];
}
}
}
?>
<main id="main-content" class="site-main content-shell content-shell--stream content-shell--forum" tabindex="-1">
<div class="content-wrap container">
<div class="content-layout content-layout--no-sidebar">
<div class="content-layout__primary">
<?php if (function_exists('aksrt_breadcrumbs')) { aksrt_breadcrumbs(); } ?>
<div class="aksrt-forum-plate-cat">
<div class="aksrt-forum-plate-cat__header">
<h1><?php echo esc_html($term ? $term->name : ''); ?></h1>
<?php if ($term && $term->description) : ?>
<p><?php echo esc_html($term->description); ?></p>
<?php endif; ?>
<?php if (!empty($cat_moderators)) : ?>
<div class="aksrt-forum-plate-cat__moderators">
<span><?php esc_html_e('分区版主:', 'aksrt'); ?></span>
<?php foreach ($cat_moderators as $mod) : ?>
<span class="aksrt-forum-plate-cat__moderator">
<?php if (!empty($mod['avatar'])) : ?>
<img src="<?php echo esc_url($mod['avatar']); ?>" alt="" width="24" height="24">
<?php endif; ?>
<?php echo esc_html($mod['name']); ?>
</span>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<div class="aksrt-forum-plate-cat__plates">
<?php if (!empty($plates)) : ?>
<?php foreach ($plates as $plate) : ?>
<a href="<?php echo esc_url((string) ($plate['url'] ?? '#')); ?>" class="aksrt-forum-plate-cat__plate-card">
<?php if (!empty($plate['cover_url'])) : ?>
<img class="aksrt-forum-plate-cat__plate-cover" src="<?php echo esc_url($plate['cover_url']); ?>" alt="" loading="lazy">
<?php elseif (!empty($plate['icon'])) : ?>
<div class="aksrt-forum-plate-cat__plate-icon"><i class="<?php echo esc_attr($plate['icon']); ?>"></i></div>
<?php endif; ?>
<div class="aksrt-forum-plate-cat__plate-info">
<h3><?php echo esc_html((string) ($plate['name'] ?? '')); ?></h3>
<p><?php echo esc_html((string) ($plate['description'] ?? '')); ?></p>
<div class="aksrt-forum-plate-cat__plate-meta">
<span><?php printf(esc_html__('%d 主题', 'aksrt'), (int) ($plate['post_count'] ?? 0)); ?></span>
<span><?php printf(esc_html__('%d 关注', 'aksrt'), (int) ($plate['follow_count'] ?? 0)); ?></span>
<?php if (!empty($plate['is_hot'])) : ?>
<span class="aksrt-forum-plate-cat__hot-badge"><?php esc_html_e('热门', 'aksrt'); ?></span>
<?php endif; ?>
</div>
</div>
</a>
<?php endforeach; ?>
<?php else : ?>
<div class="aksrt-forum-plate-cat__empty">
<p><?php esc_html_e('该分区暂无版块。', 'aksrt'); ?></p>
</div>
<?php endif; ?>
</div>
<div class="aksrt-forum-plate-cat__back">
<a href="<?php echo esc_url(aksrt_get_forum_home_url()); ?>">
<i class="fas fa-arrow-left"></i> <?php printf(esc_html__('返回%s', 'aksrt'), esc_html($forum_name)); ?>
</a>
</div>
</div>
</div>
</div>
</div>
</main>
<?php get_footer(); ?>