feat(widgets): shared forum topic/plate renderers for list depth

Extract aksrt_render_forum_topic_mini/detail and plate row/card helpers,
then wire TopicLists, PlateLists, and BoardList for zibll-aligned DOM,
lazy thumbs, and identity-aware topic rows.
This commit is contained in:
kate522 committed 2026-07-21 10:39:16 +08:00
1 parent 8b73a9443f
commit 9c5ac01119
5 files changed
+443 -42

No files matched your search

+12 -13
View File
@@ -79,26 +79,25 @@ class WidgetForumTopicLists extends \WP_Widget {
if (!$q->have_posts()) {
return '';
}
$list_class = $style === 'detail' ? 'aksrt-ftopic-list is-detail' : 'aksrt-ftopic-list is-mini';
ob_start();
echo '<ul class="' . esc_attr($list_class) . '">';
echo $style === 'detail'
? '<div class="forum-posts-lists aksrt-ftopic-list is-detail">'
: '<div class="forum-posts-lists aksrt-ftopic-list is-mini">';
while ($q->have_posts()) {
$q->the_post();
$views = (int) get_post_meta(get_the_ID(), '_aksrt_views', true);
echo '<li class="aksrt-ftopic-list__item ajax-item">';
echo '<a class="aksrt-ftopic-list__link" href="' . esc_url(get_permalink()) . '">' . esc_html(get_the_title()) . '</a>';
if ($style === 'detail') {
echo '<div class="aksrt-ftopic-list__meta">';
echo '<span>' . esc_html(get_the_author()) . '</span>';
echo '<span>' . esc_html(get_the_date()) . '</span>';
echo '<span><i class="fas fa-eye"></i> ' . esc_html((string) $views) . '</span>';
echo '</div>';
if ($style === 'detail' && function_exists('aksrt_render_forum_topic_detail')) {
echo aksrt_render_forum_topic_detail(null, 'ajax-item', true); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} elseif (function_exists('aksrt_render_forum_topic_mini')) {
echo aksrt_render_forum_topic_mini(null, 'ajax-item', true); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
$views = (int) get_post_meta(get_the_ID(), '_aksrt_views', true);
echo '<div class="aksrt-ftopic-list__item ajax-item">';
echo '<a class="aksrt-ftopic-list__link" href="' . esc_url(get_permalink()) . '">' . esc_html(get_the_title()) . '</a>';
echo '<span class="aksrt-ftopic-list__views">' . esc_html((string) $views) . '</span>';
echo '</div>';
}
echo '</li>';
}
echo '</ul>';
echo '</div>';
wp_reset_postdata();
return (string) ob_get_clean();
}