统一 archive/category/tag/search 主内容流壳层
抽出 aksrt-archive 共享 shell/stream/render config, 四类列表页统一 content-shell + shared renderer + page-owned sidebar。
This commit is contained in:
1 parent
91945e2006
commit
a9ee8c451f
6 files changed
+777
-555
No files matched your search
+143
-172
@@ -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',
|
||||
]);
|
||||
}
|
||||
?>
|
||||
<?php if (function_exists('aksrt_archive_render_widget_zone')) { aksrt_archive_render_widget_zone(['cat_top_content']); } elseif (is_active_sidebar('cat_top_content')) { dynamic_sidebar('cat_top_content'); } ?>
|
||||
|
||||
<main id="main-content" class="site-main container" tabindex="-1">
|
||||
<?php
|
||||
if (is_active_sidebar('cat_top_fluid')) {
|
||||
echo '<div class="fluid-widget-wrap">';
|
||||
dynamic_sidebar('cat_top_fluid');
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
<div class="content-wrap">
|
||||
<div class="content-layout<?php echo $has_sidebar ? '' : ' content-layout--no-sidebar'; ?>">
|
||||
<div class="content-layout__primary">
|
||||
<div class="content-main content-main--archive content-main--category">
|
||||
<?php if (function_exists('aksrt_breadcrumbs')) { aksrt_breadcrumbs(); } ?>
|
||||
|
||||
<?php if (is_active_sidebar('cat_top_content')) { dynamic_sidebar('cat_top_content'); } ?>
|
||||
|
||||
<div class="content-main content-main--archive content-main--category">
|
||||
<?php if (function_exists('aksrt_breadcrumbs')) { aksrt_breadcrumbs(); } ?>
|
||||
|
||||
<?php if ($header_style !== 'none') : ?>
|
||||
<header class="page-header term-page-header term-page-header--<?php echo esc_attr($header_style); ?><?php echo (!empty($archive_settings['show_cover']) && !empty($archive_settings['cover_url']) && $header_style === 'cover') ? ' has-cover-bg' : ''; ?>">
|
||||
<?php if (!empty($archive_settings['show_cover']) && !empty($archive_settings['cover_url']) && $header_style === 'cover') : ?>
|
||||
<div class="term-page-header__cover-bg" style="background-image:url('<?php echo esc_url((string) $archive_settings['cover_url']); ?>')">
|
||||
<div class="term-page-header__cover-overlay"></div>
|
||||
<?php if ($header_style !== 'none') : ?>
|
||||
<header class="page-header term-page-header term-page-header--<?php echo esc_attr($header_style); ?><?php echo (!empty($archive_settings['show_cover']) && !empty($archive_settings['cover_url']) && $header_style === 'cover') ? ' has-cover-bg' : ''; ?>">
|
||||
<?php if (!empty($archive_settings['show_cover']) && !empty($archive_settings['cover_url']) && $header_style === 'cover') : ?>
|
||||
<div class="term-page-header__cover-bg" style="background-image:url('<?php echo esc_url((string) $archive_settings['cover_url']); ?>')">
|
||||
<div class="term-page-header__cover-overlay"></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="term-page-header__body<?php echo $header_style === 'cover' ? ' term-page-header__body--overlay' : ''; ?>">
|
||||
<div>
|
||||
<p class="term-page-header__eyebrow"><?php esc_html_e('分类归档', 'aksrt'); ?></p>
|
||||
<h1 class="entry-title"><?php single_cat_title(); ?></h1>
|
||||
<?php if ($description !== '') : ?>
|
||||
<p class="term-page-header__desc"><?php echo $description; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if (function_exists('aksrt_render_admin_quick_link')) { aksrt_render_admin_quick_link('page-display/category', __('分类页设置', 'aksrt')); } ?>
|
||||
</div>
|
||||
<?php if (!empty($archive_settings['show_cover']) && $header_style !== 'cover') : ?>
|
||||
<div class="term-page-header__cover" style="background-image:url('<?php echo esc_url((string) $archive_settings['cover_url']); ?>')"></div>
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
<?php endif; ?>
|
||||
<div class="term-page-header__body<?php echo $header_style === 'cover' ? ' term-page-header__body--overlay' : ''; ?>">
|
||||
<div>
|
||||
<p class="term-page-header__eyebrow"><?php esc_html_e('分类归档', 'aksrt'); ?></p>
|
||||
<h1 class="entry-title"><?php single_cat_title(); ?></h1>
|
||||
<?php if ($description !== '') : ?>
|
||||
<p class="term-page-header__desc"><?php echo $description; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($archive_settings['filter_bar']) && (!empty($filter_terms) || !empty($tag_filter_terms) || !empty($custom_dimensions))) : ?>
|
||||
<div class="archive-filter-bar<?php echo $ajax_filter ? ' archive-filter-bar--ajax' : ''; ?>" aria-label="<?php esc_attr_e('分类筛选', 'aksrt'); ?>"<?php if ($ajax_filter) : ?> data-ajax-archive="category" data-term-id="<?php echo (int) $term->term_id; ?>" data-query-context="archive" data-render-mode="<?php echo esc_attr($layout_mode); ?>" data-card-style="<?php echo esc_attr($card_style); ?>"<?php endif; ?>>
|
||||
<?php if (!empty($filter_terms)) : ?>
|
||||
<div class="archive-filter-bar__main">
|
||||
<span class="archive-filter-bar__label"><?php esc_html_e('分类导航', 'aksrt'); ?></span>
|
||||
<div class="archive-filter-bar__chips">
|
||||
<a class="archive-filter-bar__chip<?php echo (empty($term->parent) && $current_filter_cat === '') ? ' is-active' : ''; ?>" href="<?php echo esc_url($filter_all_url); ?>"<?php if ($ajax_filter) : ?> data-filter-cat="0"<?php endif; ?>><?php esc_html_e('全部', 'aksrt'); ?></a>
|
||||
<?php foreach ($filter_terms as $filter_term) : ?>
|
||||
<?php $is_current = ((int) $filter_term->term_id === (int) $term->term_id) || ($current_filter_cat !== '' && (int) $current_filter_cat === (int) $filter_term->term_id); ?>
|
||||
<a class="archive-filter-bar__chip<?php echo $is_current ? ' is-active' : ''; ?>" href="<?php echo esc_url(get_term_link($filter_term)); ?>"<?php if ($ajax_filter) : ?> data-filter-cat="<?php echo (int) $filter_term->term_id; ?>"<?php endif; ?>><?php echo esc_html($filter_term->name); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (function_exists('aksrt_render_admin_quick_link')) { aksrt_render_admin_quick_link('page-display/category', __('分类页设置', 'aksrt')); } ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($tag_filter_terms)) : ?>
|
||||
<div class="archive-filter-bar__main archive-filter-bar__main--tags">
|
||||
<span class="archive-filter-bar__label"><?php esc_html_e('标签', 'aksrt'); ?></span>
|
||||
<div class="archive-filter-bar__chips">
|
||||
<a class="archive-filter-bar__chip<?php echo $current_filter_tag === '' ? ' is-active' : ''; ?>" href="<?php echo esc_url(remove_query_arg(['aksrt_filter_tag'])); ?>"<?php if ($ajax_filter) : ?> data-filter-tag=""<?php endif; ?>><?php esc_html_e('全部', 'aksrt'); ?></a>
|
||||
<?php foreach ($tag_filter_terms as $tag_term) : ?>
|
||||
<?php $is_current_tag = ($current_filter_tag !== '' && (int) $current_filter_tag === (int) $tag_term->term_id); ?>
|
||||
<a class="archive-filter-bar__chip<?php echo $is_current_tag ? ' is-active' : ''; ?>" href="<?php echo esc_url(add_query_arg('aksrt_filter_tag', (int) $tag_term->term_id)); ?>"<?php if ($ajax_filter) : ?> data-filter-tag="<?php echo (int) $tag_term->term_id; ?>"<?php endif; ?>><?php echo esc_html($tag_term->name); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="archive-filter-bar__meta">
|
||||
<?php printf(esc_html(_n('%d 篇文章', '%d 篇文章', (int) $term->count, 'aksrt')), (int) $term->count); ?>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($filter_settings['enabled']) && !empty($filter_settings['sort'])) : ?>
|
||||
<div class="archive-filter-bar__sort" aria-label="<?php esc_attr_e('排序方式', 'aksrt'); ?>">
|
||||
<?php foreach ($sort_links as $sort_key => $sort_url) : ?>
|
||||
<a class="archive-filter-bar__chip<?php echo $current_sort === $sort_key ? ' is-active' : ''; ?>" href="<?php echo esc_url($sort_url); ?>"<?php if ($ajax_filter) : ?> data-filter-sort="<?php echo esc_attr($sort_key); ?>"<?php endif; ?>>
|
||||
<?php echo esc_html($sort_key === 'oldest' ? __('最早', 'aksrt') : ($sort_key === 'popular' ? __('热门', 'aksrt') : __('最新', 'aksrt'))); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($custom_dimensions as $dim) : ?>
|
||||
<div class="archive-filter-bar__main archive-filter-bar__main--custom">
|
||||
<span class="archive-filter-bar__label"><?php echo esc_html($dim['name']); ?></span>
|
||||
<div class="archive-filter-bar__chips">
|
||||
<?php $cf_all_url = remove_query_arg('aksrt_cf_' . $dim['key']); ?>
|
||||
<a class="archive-filter-bar__chip<?php echo ($current_cf_values[$dim['key']] ?? '') === '' ? ' is-active' : ''; ?>" href="<?php echo esc_url($cf_all_url); ?>"<?php if ($ajax_filter) : ?> data-filter-cf="<?php echo esc_attr($dim['key']); ?>" data-filter-cf-val=""<?php endif; ?>><?php esc_html_e('全部', 'aksrt'); ?></a>
|
||||
<?php foreach ($dim['vals'] as $val) : ?>
|
||||
<?php $is_current_cf = ($current_cf_values[$dim['key']] ?? '') === $val['key']; ?>
|
||||
<a class="archive-filter-bar__chip<?php echo $is_current_cf ? ' is-active' : ''; ?>" href="<?php echo esc_url(add_query_arg('aksrt_cf_' . $dim['key'], $val['key'])); ?>"<?php if ($ajax_filter) : ?> data-filter-cf="<?php echo esc_attr($dim['key']); ?>" data-filter-cf-val="<?php echo esc_attr($val['key']); ?>"<?php endif; ?>><?php echo esc_html($val['name']); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php if (!empty($archive_settings['show_cover']) && $header_style !== 'cover') : ?>
|
||||
<div class="term-page-header__cover" style="background-image:url('<?php echo esc_url((string) $archive_settings['cover_url']); ?>')"></div>
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($archive_settings['filter_bar']) && (!empty($filter_terms) || !empty($tag_filter_terms) || !empty($custom_dimensions))) : ?>
|
||||
<div class="archive-filter-bar<?php echo $ajax_filter ? ' archive-filter-bar--ajax' : ''; ?>" aria-label="<?php esc_attr_e('分类筛选', 'aksrt'); ?>"<?php if ($ajax_filter) : ?> data-ajax-archive="category" data-term-id="<?php echo (int) $term->term_id; ?>" data-query-context="archive" data-render-mode="<?php echo esc_attr($layout_mode); ?>" data-card-style="<?php echo esc_attr($card_style); ?>"<?php endif; ?>>
|
||||
<?php if (!empty($filter_terms)) : ?>
|
||||
<div class="archive-filter-bar__main">
|
||||
<span class="archive-filter-bar__label"><?php esc_html_e('分类导航', 'aksrt'); ?></span>
|
||||
<div class="archive-filter-bar__chips">
|
||||
<a class="archive-filter-bar__chip<?php echo (empty($term->parent) && $current_filter_cat === '') ? ' is-active' : ''; ?>" href="<?php echo esc_url($filter_all_url); ?>"<?php if ($ajax_filter) : ?> data-filter-cat="0"<?php endif; ?>>
|
||||
<?php esc_html_e('全部', 'aksrt'); ?>
|
||||
</a>
|
||||
<?php foreach ($filter_terms as $filter_term) : ?>
|
||||
<?php $is_current = ((int) $filter_term->term_id === (int) $term->term_id) || ($current_filter_cat !== '' && (int) $current_filter_cat === (int) $filter_term->term_id); ?>
|
||||
<a class="archive-filter-bar__chip<?php echo $is_current ? ' is-active' : ''; ?>" href="<?php echo esc_url(get_term_link($filter_term)); ?>"<?php if ($ajax_filter) : ?> data-filter-cat="<?php echo (int) $filter_term->term_id; ?>"<?php endif; ?>>
|
||||
<?php echo esc_html($filter_term->name); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php
|
||||
if (function_exists('aksrt_archive_render_stream')) {
|
||||
aksrt_archive_render_stream(null, $render_config, [
|
||||
'page_kind' => 'category',
|
||||
'query_context' => 'archive',
|
||||
'stream_class' => 'archive__ajax-wrap content-stream--archive content-stream--category',
|
||||
'empty_text' => __('该分类下暂无文章', 'aksrt'),
|
||||
'ajax_enabled' => $ajax_filter,
|
||||
'show_loading' => $ajax_filter,
|
||||
]);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if (function_exists('aksrt_archive_render_widget_zone')) { aksrt_archive_render_widget_zone(['cat_bottom_content']); } elseif (is_active_sidebar('cat_bottom_content')) { dynamic_sidebar('cat_bottom_content'); } ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($tag_filter_terms)) : ?>
|
||||
<div class="archive-filter-bar__main archive-filter-bar__main--tags">
|
||||
<span class="archive-filter-bar__label"><?php esc_html_e('标签', 'aksrt'); ?></span>
|
||||
<div class="archive-filter-bar__chips">
|
||||
<a class="archive-filter-bar__chip<?php echo $current_filter_tag === '' ? ' is-active' : ''; ?>" href="<?php echo esc_url(remove_query_arg(['aksrt_filter_tag'])); ?>"<?php if ($ajax_filter) : ?> data-filter-tag=""<?php endif; ?>>
|
||||
<?php esc_html_e('全部', 'aksrt'); ?>
|
||||
</a>
|
||||
<?php foreach ($tag_filter_terms as $tag_term) : ?>
|
||||
<?php $is_current_tag = ($current_filter_tag !== '' && (int) $current_filter_tag === (int) $tag_term->term_id); ?>
|
||||
<a class="archive-filter-bar__chip<?php echo $is_current_tag ? ' is-active' : ''; ?>" href="<?php echo esc_url(add_query_arg('aksrt_filter_tag', (int) $tag_term->term_id)); ?>"<?php if ($ajax_filter) : ?> data-filter-tag="<?php echo (int) $tag_term->term_id; ?>"<?php endif; ?>>
|
||||
<?php echo esc_html($tag_term->name); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="archive-filter-bar__meta">
|
||||
<?php printf(esc_html(_n('%d 篇文章', '%d 篇文章', (int) $term->count, 'aksrt')), (int) $term->count); ?>
|
||||
</div>
|
||||
<?php if (!empty($filter_settings['enabled']) && !empty($filter_settings['sort'])) : ?>
|
||||
<div class="archive-filter-bar__sort" aria-label="<?php esc_attr_e('排序方式', 'aksrt'); ?>">
|
||||
<?php foreach ($sort_links as $sort_key => $sort_url) : ?>
|
||||
<a class="archive-filter-bar__chip<?php echo $current_sort === $sort_key ? ' is-active' : ''; ?>" href="<?php echo esc_url($sort_url); ?>"<?php if ($ajax_filter) : ?> data-filter-sort="<?php echo esc_attr($sort_key); ?>"<?php endif; ?>>
|
||||
<?php echo esc_html($sort_key === 'oldest' ? __('最早', 'aksrt') : ($sort_key === 'popular' ? __('热门', 'aksrt') : __('最新', 'aksrt'))); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($custom_dimensions as $dim) : ?>
|
||||
<div class="archive-filter-bar__main archive-filter-bar__main--custom">
|
||||
<span class="archive-filter-bar__label"><?php echo esc_html($dim['name']); ?></span>
|
||||
<div class="archive-filter-bar__chips">
|
||||
<?php $cf_all_url = remove_query_arg('aksrt_cf_' . $dim['key']); ?>
|
||||
<a class="archive-filter-bar__chip<?php echo ($current_cf_values[$dim['key']] ?? '') === '' ? ' is-active' : ''; ?>" href="<?php echo esc_url($cf_all_url); ?>"<?php if ($ajax_filter) : ?> data-filter-cf="<?php echo esc_attr($dim['key']); ?>" data-filter-cf-val=""<?php endif; ?>>
|
||||
<?php esc_html_e('全部', 'aksrt'); ?>
|
||||
</a>
|
||||
<?php foreach ($dim['vals'] as $val) : ?>
|
||||
<?php $is_current_cf = ($current_cf_values[$dim['key']] ?? '') === $val['key']; ?>
|
||||
<a class="archive-filter-bar__chip<?php echo $is_current_cf ? ' is-active' : ''; ?>" href="<?php echo esc_url(add_query_arg('aksrt_cf_' . $dim['key'], $val['key'])); ?>"<?php if ($ajax_filter) : ?> data-filter-cf="<?php echo esc_attr($dim['key']); ?>" data-filter-cf-val="<?php echo esc_attr($val['key']); ?>"<?php endif; ?>>
|
||||
<?php echo esc_html($val['name']); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="archive__ajax-wrap content-stream content-stream--archive content-stream--category<?php echo $ajax_filter ? ' is-ajax-enabled' : ''; ?>" data-page-kind="category" data-render-mode="<?php echo esc_attr($layout_mode); ?>" data-card-style="<?php echo esc_attr($card_style); ?>"<?php if ($ajax_filter) : ?> data-ajax-wrap data-query-context="archive"<?php endif; ?>>
|
||||
<div class="archive__ajax-loading" aria-hidden="true"><span class="archive__ajax-spinner"></span></div>
|
||||
<?php if (have_posts()) : ?>
|
||||
<?php aksrt_render_post_list(null, array_merge($render_config, ['wrapper_class' => 'content-stream__list'])); ?>
|
||||
<div class="content-stream__footer">
|
||||
<?php aksrt_render_pagination(null, ['query_context' => 'archive', 'render_config' => $render_config]); ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div class="no-results content-stream__empty">
|
||||
<p><?php esc_html_e('该分类下暂无文章', 'aksrt'); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (is_active_sidebar('cat_bottom_content')) { dynamic_sidebar('cat_bottom_content'); } ?>
|
||||
</div>
|
||||
|
||||
<?php if ($has_sidebar) : ?>
|
||||
<?php get_sidebar(); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (is_active_sidebar('cat_bottom_fluid')) {
|
||||
echo '<div class="fluid-widget-wrap">';
|
||||
dynamic_sidebar('cat_bottom_fluid');
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</main>
|
||||
|
||||
<?php
|
||||
if (function_exists('aksrt_archive_close_shell')) {
|
||||
aksrt_archive_close_shell([
|
||||
'has_sidebar' => $has_sidebar,
|
||||
'bottom_fluid' => ['cat_bottom_fluid'],
|
||||
]);
|
||||
}
|
||||
|
||||
get_footer();
|
||||
Reference in new issue
Block a user