diff --git a/archive.php b/archive.php
index 12ea2423..1792a1b5 100644
--- a/archive.php
+++ b/archive.php
@@ -11,47 +11,19 @@ get_header();
global $wp_query;
-$list_settings = class_exists('AKSRT_Settings')
- ? AKSRT_Settings::get_post_list_style_settings()
- : ['render_mode' => 'card', 'card_style' => 'standard'];
-$render_config = [
- 'context' => 'archive',
- 'mode' => (string) ($list_settings['render_mode'] ?? 'card'),
- 'card_style' => (string) ($list_settings['card_style'] ?? 'standard'),
-];
+$render_config = function_exists('aksrt_archive_get_render_config')
+ ? aksrt_archive_get_render_config(['context' => 'archive'])
+ : ['context' => 'archive', 'mode' => 'card', 'card_style' => 'standard'];
+$has_sidebar = function_exists('aksrt_archive_has_sidebar')
+ ? aksrt_archive_has_sidebar()
+ : (function_exists('aksrt_is_show_sidebar') ? aksrt_is_show_sidebar() : false);
-// Per-category card mode override: if visiting a category in card_cat_ids, force card mode
-if (is_category() && !empty($list_settings['card_cat_ids'])) {
- $current_cat_id = (int) get_queried_object_id();
- if (in_array($current_cat_id, $list_settings['card_cat_ids'], true)) {
- $render_config['mode'] = 'card';
- }
-}
-
-// Per-category multi-thumb override
-if (is_category() && class_exists('AKSRT_Settings')) {
- $thumb_settings = AKSRT_Settings::get_post_thumb_settings();
- if (!empty($thumb_settings['mult_thumb_cat_ids'])) {
- $current_cat_id = (int) get_queried_object_id();
- if (in_array($current_cat_id, $thumb_settings['mult_thumb_cat_ids'], true)) {
- $render_config['multi_thumb_enabled'] = true;
- $render_config['multi_thumb_limit'] = (int) ($thumb_settings['multi_count'] ?? 4);
- }
- }
-}
-
-$has_sidebar = function_exists('aksrt_is_show_sidebar') ? aksrt_is_show_sidebar() : false;
-$archive_description = trim(strip_tags((string) get_the_archive_description()));
+$archive_description = trim(wp_strip_all_tags((string) get_the_archive_description()));
$archive_summary = '';
-
if (is_author()) {
$author = get_queried_object();
if ($author instanceof WP_User) {
- $archive_summary = sprintf(
- /* translators: %s: author display name */
- __('作者:%s', 'aksrt'),
- $author->display_name
- );
+ $archive_summary = sprintf(__('作者:%s', 'aksrt'), $author->display_name);
}
} elseif ($archive_description !== '') {
$archive_summary = $archive_description;
@@ -61,43 +33,51 @@ if (is_author()) {
(int) $wp_query->found_posts
);
}
+
+if (function_exists('aksrt_archive_open_shell')) {
+ aksrt_archive_open_shell([
+ 'main_class' => 'site-main content-shell content-shell--stream',
+ 'has_sidebar' => $has_sidebar,
+ 'page_kind' => 'archive',
+ ]);
+} else {
+ echo '';
+}
+
get_footer();
diff --git a/category.php b/category.php
index 07b5ece5..43c096d1 100644
--- a/category.php
+++ b/category.php
@@ -11,22 +11,22 @@ get_header();
$term = get_queried_object();
if (class_exists('AKSRT_Docs_Presenter')) {
- $docs_presenter = AKSRT_Docs_Presenter::get_instance();
- if ($term instanceof WP_Term && $term->taxonomy === 'category') {
- $doc_candidates = get_posts([
- 'post_type' => 'page',
- 'post_status' => 'publish',
- 'posts_per_page' => 1,
- 'meta_key' => '_aksrt_doc_category',
- 'meta_value' => (string) $term->term_id,
- 'fields' => 'ids',
- ]);
- if (!empty($doc_candidates)) {
- get_template_part('templates/pages/page-documentnav');
- get_footer();
- return;
- }
- }
+ $docs_presenter = AKSRT_Docs_Presenter::get_instance();
+ if ($term instanceof WP_Term && $term->taxonomy === 'category') {
+ $doc_candidates = get_posts([
+ 'post_type' => 'page',
+ 'post_status' => 'publish',
+ 'posts_per_page' => 1,
+ 'meta_key' => '_aksrt_doc_category',
+ 'meta_value' => (string) $term->term_id,
+ 'fields' => 'ids',
+ ]);
+ if (!empty($doc_candidates)) {
+ get_template_part('templates/pages/page-documentnav');
+ get_footer();
+ return;
+ }
+ }
}
if (!$term instanceof WP_Term) {
get_footer();
@@ -44,10 +44,12 @@ $archive_settings = class_exists('AKSRT_Term_Meta')
'filter_bar' => true,
'cover_url' => '',
'description' => (string) $term->description,
+ 'card_style' => 'standard',
];
-$sidebar_id = is_active_sidebar('cat_sidebar') ? 'cat_sidebar' : 'sidebar-blog';
-$has_sidebar = !empty($archive_settings['show_sidebar']) && is_active_sidebar($sidebar_id);
+$has_sidebar = function_exists('aksrt_archive_has_sidebar')
+ ? aksrt_archive_has_sidebar('cat_sidebar', !empty($archive_settings['show_sidebar']))
+ : (!empty($archive_settings['show_sidebar']) && (is_active_sidebar('cat_sidebar') || is_active_sidebar('sidebar-blog')));
$description = !empty($archive_settings['show_desc']) ? wp_kses_post((string) $archive_settings['description']) : '';
$header_style = (string) $archive_settings['header_style'];
$layout_mode = (string) $archive_settings['layout_mode'];
@@ -63,37 +65,29 @@ $cat_filter_config = class_exists('AKSRT_Settings')
? AKSRT_Settings::get_filter_config_for_category((int) $term->term_id)
: ['dimensions' => [], 'show_cat' => true, 'show_tag' => false, 'show_topics' => false, 'show_orderby' => true];
$custom_dimensions = $cat_filter_config['dimensions'];
-$current_orderby = sanitize_key((string) get_query_var('orderby'));
-$current_order = strtoupper(sanitize_key((string) get_query_var('order')));
-$current_sort = 'latest';
-
-if ($current_orderby === 'date' && $current_order === 'ASC') {
- $current_sort = 'oldest';
-} elseif ($current_orderby === 'comment_count') {
- $current_sort = 'popular';
-}
-
-$render_config = [
- 'context' => 'category',
- 'mode' => $layout_mode,
- 'card_style' => $card_style,
-];
-$sort_links = [
- 'latest' => remove_query_arg(['orderby', 'order', 'paged']),
- 'oldest' => add_query_arg(['orderby' => 'date', 'order' => 'asc', 'paged' => false]),
- 'popular' => add_query_arg(['orderby' => 'comment_count', 'order' => 'desc', 'paged' => false]),
-];
+$sort_state = function_exists('aksrt_archive_get_sort_state') ? aksrt_archive_get_sort_state() : ['current' => 'latest', 'links' => []];
+$current_sort = $sort_state['current'];
+$sort_links = $sort_state['links'];
+$render_config = function_exists('aksrt_archive_get_render_config')
+ ? aksrt_archive_get_render_config([
+ 'context' => 'category',
+ 'mode' => $layout_mode,
+ 'card_style' => $card_style,
+ ])
+ : [
+ 'context' => 'category',
+ 'mode' => $layout_mode,
+ 'card_style' => $card_style,
+ ];
$filter_terms = [];
$filter_all_url = get_category_link($term->term_id);
if (!empty($archive_settings['filter_bar'])) {
- $filter_parent = $term->term_id;
$filter_terms = get_terms([
'taxonomy' => 'category',
'hide_empty' => true,
- 'parent' => $filter_parent,
+ 'parent' => $term->term_id,
]);
-
if (empty($filter_terms) && !empty($term->parent)) {
$filter_all_url = get_category_link((int) $term->parent);
$filter_terms = get_terms([
@@ -102,7 +96,6 @@ if (!empty($archive_settings['filter_bar'])) {
'parent' => (int) $term->parent,
]);
}
-
if (is_wp_error($filter_terms)) {
$filter_terms = [];
}
@@ -126,145 +119,123 @@ if ($ajax_filter && !empty($filter_settings['cat_show_tag'])) {
$tag_filter_terms = [];
}
}
+
+if (function_exists('aksrt_archive_open_shell')) {
+ aksrt_archive_open_shell([
+ 'main_class' => 'site-main container content-shell content-shell--stream',
+ 'has_sidebar' => $has_sidebar,
+ 'top_fluid' => ['cat_top_fluid'],
+ 'page_kind' => 'category',
+ ]);
+}
?>
+
-
- ';
- dynamic_sidebar('cat_top_fluid');
- echo '';
- }
- ?>
-
-