feat(topics): restore topic taxonomy workflow

This commit is contained in:
kate522 committed 2026-11-10 22:31:11 +08:00
1 parent f3dd1ec3b1
commit a254cbd3e9
59 files changed
+771 -192

No files matched your search

+3 -1
View File
@@ -23,6 +23,7 @@ if (!function_exists('jio_renderer_defaults')) {
'is_home' => is_home() || is_front_page(),
'is_author' => is_author(),
'is_tag' => is_tag(),
'is_topics' => function_exists('is_tax') && is_tax('topics'),
'highlight_query' => '',
'wrapper_class' => '',
'skip_wrapper' => false,
@@ -56,6 +57,7 @@ if (!function_exists('jio_renderer_config')) {
}
if (!$is_forced && !$is_card) {
$is_card = (!empty($args['is_tag']) && !empty($list['list_card_tag']))
|| (!empty($args['is_topics']) && !empty($list['list_card_topics']))
|| (!empty($args['is_home']) && !empty($list['list_card_home']))
|| (!empty($args['is_author']) && !empty($list['list_card_author']));
}
@@ -83,7 +85,7 @@ if (!function_exists('jio_renderer_config')) {
$args['show_time'] = !empty($list['post_list_time']);
$args['time_source'] = (string) ($list['post_time_source'] ?? 'modified');
$args['list_orderby'] = (string) ($list['list_orderby'] ?? 'modified');
$args['badge_types'] = (array) ($list['list_badge_show'] ?? ['pay', 'cat', 'tag']);
$args['badge_types'] = (array) ($list['list_badge_show'] ?? ['pay', 'topics', 'cat', 'tag']);
$args['mult_thumb_cat'] = (array) ($list['mult_thumb_cat'] ?? []);
$args['thumb'] = $thumb;
$args['allow_conditional_layout'] = jio_is_show_sidebar() || wp_is_mobile();
+12
View File
@@ -17,6 +17,8 @@ if (!function_exists('jio_renderer_collect_post_data')) {
$images = jio_renderer_resolve_images($post_id, $cfg);
$categories = get_the_category($post_id) ?: [];
$topics = get_the_terms($post_id, 'topics');
$topics = is_array($topics) ? $topics : [];
$tags = get_the_tags($post_id) ?: [];
$content_images = (array) $images['gallery'];
$gallery = array_slice($content_images, 0, 4);
@@ -84,6 +86,7 @@ if (!function_exists('jio_renderer_collect_post_data')) {
'is_mult_thumb' => $is_mult_thumb,
'is_no_thumb' => $is_no_thumb,
'categories' => $categories,
'topics' => $topics,
'tags' => $tags,
'author_id' => $author_id,
'author_name' => $author instanceof WP_User ? $author->display_name : '',
@@ -261,6 +264,15 @@ if (!function_exists('jio_renderer_badges')) {
$items[] = '<a class="but ' . esc_attr($colors[$index % count($colors)]) . '" title="' . esc_attr__('查看更多分类文章', 'jio') . '" href="' . esc_url(get_category_link($category->term_id)) . '"><i class="fa fas fa-folder-open" aria-hidden="true"></i>' . esc_html($category->name) . '</a>';
}
}
if (empty($cfg['is_topics']) && in_array('topics', $types, true)) {
foreach (array_slice((array) ($data['topics'] ?? []), 0, 3) as $topic) {
$link = get_term_link($topic);
if (is_wp_error($link)) {
continue;
}
$items[] = '<a class="but" title="' . esc_attr__('查看此专题更多文章', 'jio') . '" href="' . esc_url($link) . '"><i class="fa fas fa-cube" aria-hidden="true"></i>' . esc_html($topic->name) . '</a>';
}
}
if (empty($cfg['is_tag']) && in_array('tag', $types, true)) {
$tags = (array) $data['tags'];
usort($tags, static fn($left, $right): int => (int) $right->count <=> (int) $left->count);