feat(topics): restore topic taxonomy workflow
This commit is contained in:
1 parent
f3dd1ec3b1
commit
a254cbd3e9
59 files changed
+771
-192
No files matched your search
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* Topic archive template.
|
||||
*
|
||||
* @package Jio
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
get_header();
|
||||
|
||||
$term = get_queried_object();
|
||||
if (!$term instanceof WP_Term || $term->taxonomy !== 'topics') {
|
||||
get_footer();
|
||||
return;
|
||||
}
|
||||
|
||||
$settings = \Jio\Core\TermMeta::resolve_archive_settings($term);
|
||||
$has_sidebar = jio_archive_has_sidebar(!empty($settings['show_sidebar']));
|
||||
$sort_state = jio_archive_get_sort_state((array) ($settings['orderby_option'] ?? []));
|
||||
$filter_groups = [];
|
||||
|
||||
foreach ([
|
||||
'category' => ['key' => 'ajax_category', 'label' => __('分类', 'jio')],
|
||||
'post_tag' => ['key' => 'ajax_tag', 'label' => __('标签', 'jio')],
|
||||
'topics' => ['key' => 'ajax_topics', 'label' => __('专题', 'jio')],
|
||||
] as $taxonomy => $filter) {
|
||||
$key = $filter['key'];
|
||||
if (empty($settings[$key . '_enabled'])) {
|
||||
continue;
|
||||
}
|
||||
$group = jio_archive_build_term_filter_group($taxonomy, (array) ($settings[$key] ?? []), $filter['label']);
|
||||
if ($group) {
|
||||
$filter_groups[] = $group;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($settings['custom_filter_enabled'])) {
|
||||
$filter_groups = array_merge(
|
||||
$filter_groups,
|
||||
jio_archive_build_custom_filter_groups(
|
||||
(array) ($settings['custom_dimensions'] ?? []),
|
||||
$settings['custom_filter_keys'] ?? 'all'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
jio_archive_open_shell([
|
||||
'main_class' => 'site-main container',
|
||||
'has_sidebar' => $has_sidebar,
|
||||
'top_fluid' => ['all_top_fluid', 'cat_top_fluid'],
|
||||
'page_kind' => 'topics',
|
||||
]);
|
||||
|
||||
jio_archive_render_widget_zone(['cat_top_content']);
|
||||
jio_archive_render_term_header([
|
||||
'header_style' => $settings['header_style'],
|
||||
'show_cover' => !empty($settings['show_cover']),
|
||||
'cover_url' => (string) ($settings['cover_url'] ?? ''),
|
||||
'title' => $term->name,
|
||||
'description' => !empty($settings['show_desc']) ? $settings['description'] : '',
|
||||
'post_count' => !empty($settings['post_count']),
|
||||
]);
|
||||
|
||||
ob_start();
|
||||
if (!empty($settings['filter_bar'])) {
|
||||
jio_archive_render_filter_bar([
|
||||
'aria_label' => __('专题筛选', 'jio'),
|
||||
'groups' => $filter_groups,
|
||||
'sort_enabled' => !empty($settings['orderby_enabled']),
|
||||
'sort_current' => $sort_state['current'],
|
||||
'sort_links' => $sort_state['links'],
|
||||
'sort_labels' => \Jio\Settings\Settings::homepage_sort_labels(),
|
||||
'sort_option' => (array) ($settings['orderby_option'] ?? []),
|
||||
]);
|
||||
}
|
||||
$filter_html = (string) ob_get_clean();
|
||||
|
||||
jio_archive_render_stream(null, jio_archive_get_render_config(['context' => 'topics']), [
|
||||
'page_kind' => 'topics',
|
||||
'query_context' => 'archive',
|
||||
'empty_text' => __('该专题下暂无文章', 'jio'),
|
||||
'filter_html' => $filter_html,
|
||||
]);
|
||||
|
||||
jio_archive_render_widget_zone(['cat_bottom_content']);
|
||||
jio_archive_close_shell([
|
||||
'has_sidebar' => $has_sidebar,
|
||||
'bottom_fluid' => ['cat_bottom_fluid', 'all_bottom_fluid'],
|
||||
]);
|
||||
get_footer();
|
||||
Reference in new issue
Block a user