对齐内容主线页骨架
This commit is contained in:
1 parent
a41a31806c
commit
4f67512dba
12 files changed
+420
-264
No files matched your search
+119
-111
@@ -129,124 +129,132 @@ $search_sort_options = [
|
||||
<div class="content-layout__primary">
|
||||
<?php if (is_active_sidebar('search_top_content')) { dynamic_sidebar('search_top_content'); } ?>
|
||||
|
||||
<?php
|
||||
$search_title = $has_search_query
|
||||
? sprintf(esc_html__('搜索”%s”', 'aksrt'), esc_html($search_query))
|
||||
: esc_html__('搜索内容', 'aksrt');
|
||||
$search_desc = $has_search_query
|
||||
? sprintf(esc_html__('共找到 %1$d 条与 “%2$s” 相关的内容。', 'aksrt'), $search_count, esc_html($search_query))
|
||||
: esc_html__('输入关键词,快速查找文章、教程和站内内容。', 'aksrt');
|
||||
$admin_link = function_exists('aksrt_render_admin_quick_link') ? aksrt_render_admin_quick_link('page-display/other', __('搜索页设置', 'aksrt')) : '';
|
||||
set_query_var('aksrt_ph_eyebrow', __('站内搜索', 'aksrt'));
|
||||
set_query_var('aksrt_ph_title', $search_title);
|
||||
set_query_var('aksrt_ph_desc', $search_desc);
|
||||
set_query_var('aksrt_ph_extra', $admin_link);
|
||||
get_template_part('templates/parts/page-header');
|
||||
?>
|
||||
<div class="content-main content-main--search">
|
||||
<?php if (function_exists('aksrt_breadcrumbs')) { aksrt_breadcrumbs(); } ?>
|
||||
|
||||
<form role="search" method="get" class="search-hero-form search-page-form" action="<?php echo esc_url(home_url('/')); ?>" data-aksrt-search-form="search-page">
|
||||
<input type="hidden" name="aksrt_search_type" value="<?php echo esc_attr($search_type); ?>">
|
||||
<span class="search-icon search-page-form__icon" aria-hidden="true">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
|
||||
</span>
|
||||
<label class="screen-reader-text" for="search-page-input"><?php esc_html_e('搜索', 'aksrt'); ?></label>
|
||||
<input type="search" id="search-page-input" name="s" value="<?php echo esc_attr($search_query); ?>" placeholder="<?php echo esc_attr($search_placeholder); ?>" autocomplete="off">
|
||||
<button type="button" class="clear-search search-page-form__clear" id="search-clear-btn" aria-label="<?php esc_attr_e('清空搜索内容', 'aksrt'); ?>"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg></button>
|
||||
<button type="submit" class="search-page-form__submit"><?php esc_html_e('搜索', 'aksrt'); ?></button>
|
||||
</form>
|
||||
<?php aksrt_render_search_hot_keywords($hot_keywords, 'aksrt-search-hot-keywords'); ?>
|
||||
<?php
|
||||
$search_title = $has_search_query
|
||||
? sprintf(esc_html__('搜索”%s”', 'aksrt'), esc_html($search_query))
|
||||
: esc_html__('搜索内容', 'aksrt');
|
||||
$search_desc = $has_search_query
|
||||
? sprintf(esc_html__('共找到 %1$d 条与 “%2$s” 相关的内容。', 'aksrt'), $search_count, esc_html($search_query))
|
||||
: esc_html__('输入关键词,快速查找文章、教程和站内内容。', 'aksrt');
|
||||
$admin_link = function_exists('aksrt_render_admin_quick_link') ? aksrt_render_admin_quick_link('page-display/other', __('搜索页设置', 'aksrt')) : '';
|
||||
set_query_var('aksrt_ph_eyebrow', __('站内搜索', 'aksrt'));
|
||||
set_query_var('aksrt_ph_title', $search_title);
|
||||
set_query_var('aksrt_ph_desc', $search_desc);
|
||||
set_query_var('aksrt_ph_extra', $admin_link);
|
||||
get_template_part('templates/parts/page-header');
|
||||
?>
|
||||
|
||||
<?php if (!empty($filter_settings['enabled'])) : ?>
|
||||
<div class="search-page-filters" aria-label="<?php esc_attr_e('搜索筛选', 'aksrt'); ?>">
|
||||
<?php if (!empty($search_type_options)) : ?>
|
||||
<div class="search-page-filters__group">
|
||||
<span class="search-page-filters__label"><?php esc_html_e('类型', 'aksrt'); ?></span>
|
||||
<div class="search-page-filters__chips">
|
||||
<?php foreach ($search_type_options as $type_key => $type_label) : ?>
|
||||
<a class="search-page-filters__chip<?php echo $search_type === $type_key ? ' is-active' : ''; ?>" href="<?php echo esc_url(add_query_arg(['aksrt_search_type' => $type_key, 'paged' => false])); ?>">
|
||||
<?php echo esc_html($type_label); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<section class="content-stream content-stream--search" data-page-kind="search" data-render-mode="<?php echo esc_attr((string) $render_config['mode']); ?>" data-card-style="<?php echo esc_attr((string) $render_config['card_style']); ?>">
|
||||
<form role="search" method="get" class="search-hero-form search-page-form" action="<?php echo esc_url(home_url('/')); ?>" data-aksrt-search-form="search-page">
|
||||
<input type="hidden" name="aksrt_search_type" value="<?php echo esc_attr($search_type); ?>">
|
||||
<span class="search-icon search-page-form__icon" aria-hidden="true">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
|
||||
</span>
|
||||
<label class="screen-reader-text" for="search-page-input"><?php esc_html_e('搜索', 'aksrt'); ?></label>
|
||||
<input type="search" id="search-page-input" name="s" value="<?php echo esc_attr($search_query); ?>" placeholder="<?php echo esc_attr($search_placeholder); ?>" autocomplete="off">
|
||||
<button type="button" class="clear-search search-page-form__clear" id="search-clear-btn" aria-label="<?php esc_attr_e('清空搜索内容', 'aksrt'); ?>"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg></button>
|
||||
<button type="submit" class="search-page-form__submit"><?php esc_html_e('搜索', 'aksrt'); ?></button>
|
||||
</form>
|
||||
<?php aksrt_render_search_hot_keywords($hot_keywords, 'aksrt-search-hot-keywords'); ?>
|
||||
|
||||
<?php if (!empty($filter_settings['categories']) && !empty($search_categories)) : ?>
|
||||
<div class="search-page-filters__group">
|
||||
<span class="search-page-filters__label"><?php esc_html_e('分类', 'aksrt'); ?></span>
|
||||
<div class="search-page-filters__select-wrap">
|
||||
<select class="search-page-filters__select" id="search-category-filter" aria-label="<?php esc_attr_e('选择分类', 'aksrt'); ?>">
|
||||
<option value=""><?php esc_html_e('全部分类', 'aksrt'); ?></option>
|
||||
<?php foreach ($search_categories as $cat) : ?>
|
||||
<option value="<?php echo esc_attr($cat->term_id); ?>"<?php selected($current_category, $cat->term_id); ?>>
|
||||
<?php echo esc_html($cat->name); ?>
|
||||
<?php if ($cat->count > 0) : ?>(<?php echo esc_html((string) $cat->count); ?>)<?php endif; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($filter_settings['enabled'])) : ?>
|
||||
<div class="search-page-filters" aria-label="<?php esc_attr_e('搜索筛选', 'aksrt'); ?>">
|
||||
<?php if (!empty($search_type_options)) : ?>
|
||||
<div class="search-page-filters__group">
|
||||
<span class="search-page-filters__label"><?php esc_html_e('类型', 'aksrt'); ?></span>
|
||||
<div class="search-page-filters__chips">
|
||||
<?php foreach ($search_type_options as $type_key => $type_label) : ?>
|
||||
<a class="search-page-filters__chip<?php echo $search_type === $type_key ? ' is-active' : ''; ?>" href="<?php echo esc_url(add_query_arg(['aksrt_search_type' => $type_key, 'paged' => false])); ?>">
|
||||
<?php echo esc_html($type_label); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($filter_settings['sort'])) : ?>
|
||||
<div class="search-page-filters__group">
|
||||
<span class="search-page-filters__label"><?php esc_html_e('排序', 'aksrt'); ?></span>
|
||||
<div class="search-page-filters__chips">
|
||||
<?php foreach ($search_sort_options as $sort_key => $sort_option) : ?>
|
||||
<?php
|
||||
$sort_url = add_query_arg(array_filter([
|
||||
'orderby' => $sort_option['args']['orderby'],
|
||||
'order' => $sort_option['args']['order'],
|
||||
'paged' => false,
|
||||
], static function ($value): bool {
|
||||
return false !== $value;
|
||||
}));
|
||||
if ($sort_key === 'relevance') {
|
||||
$sort_url = remove_query_arg(['orderby', 'order', 'paged']);
|
||||
}
|
||||
?>
|
||||
<a class="search-page-filters__chip<?php echo $current_sort === $sort_key ? ' is-active' : ''; ?>" href="<?php echo esc_url($sort_url); ?>">
|
||||
<?php echo esc_html($sort_option['label']); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($filter_settings['categories']) && !empty($search_categories)) : ?>
|
||||
<div class="search-page-filters__group">
|
||||
<span class="search-page-filters__label"><?php esc_html_e('分类', 'aksrt'); ?></span>
|
||||
<div class="search-page-filters__select-wrap">
|
||||
<select class="search-page-filters__select" id="search-category-filter" aria-label="<?php esc_attr_e('选择分类', 'aksrt'); ?>">
|
||||
<option value=""><?php esc_html_e('全部分类', 'aksrt'); ?></option>
|
||||
<?php foreach ($search_categories as $cat) : ?>
|
||||
<option value="<?php echo esc_attr($cat->term_id); ?>"<?php selected($current_category, $cat->term_id); ?>>
|
||||
<?php echo esc_html($cat->name); ?>
|
||||
<?php if ($cat->count > 0) : ?>(<?php echo esc_html((string) $cat->count); ?>)<?php endif; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="search-page-toolbar" aria-label="<?php esc_attr_e('搜索状态', 'aksrt'); ?>">
|
||||
<span class="search-page-toolbar__count"><?php printf(esc_html(_n('%d 条结果', '%d 条结果', $search_count, 'aksrt')), $search_count); ?></span>
|
||||
<?php if ($has_search_query) : ?>
|
||||
<a class="search-page-toolbar__reset" href="<?php echo esc_url(home_url('/')); ?>"><?php esc_html_e('清除条件', 'aksrt'); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if ($loop_query->have_posts()) : ?>
|
||||
<?php aksrt_render_post_list($loop_query, $render_config); ?>
|
||||
<?php aksrt_render_pagination($loop_query, ['query_context' => 'search', 'render_config' => $render_config]); ?>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
<?php else : ?>
|
||||
<div class="no-results search-page-empty">
|
||||
<p class="search-page-empty__icon" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg></p>
|
||||
<h2><?php esc_html_e('未找到相关内容', 'aksrt'); ?></h2>
|
||||
<p class="search-page-empty__text"><?php esc_html_e('换一个更具体的关键词,或者从常用入口继续浏览。', 'aksrt'); ?></p>
|
||||
<div class="search-page-empty__tips">
|
||||
<span><?php esc_html_e('建议:', 'aksrt'); ?></span>
|
||||
<span><?php esc_html_e('减少修饰词', 'aksrt'); ?></span>
|
||||
<span><?php esc_html_e('尝试文章标题中的核心名词', 'aksrt'); ?></span>
|
||||
<span><?php esc_html_e('改用更短的关键词', 'aksrt'); ?></span>
|
||||
</div>
|
||||
<div class="search-page-empty__actions">
|
||||
<a class="btn-outline" href="<?php echo esc_url(home_url('/')); ?>"><?php esc_html_e('返回首页', 'aksrt'); ?></a>
|
||||
<?php if (!empty($popular_categories)) : ?>
|
||||
<?php foreach ($popular_categories as $category) : ?>
|
||||
<a class="search-page-empty__chip" href="<?php echo esc_url(get_category_link($category->term_id)); ?>"><?php echo esc_html($category->name); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if (!empty($filter_settings['sort'])) : ?>
|
||||
<div class="search-page-filters__group">
|
||||
<span class="search-page-filters__label"><?php esc_html_e('排序', 'aksrt'); ?></span>
|
||||
<div class="search-page-filters__chips">
|
||||
<?php foreach ($search_sort_options as $sort_key => $sort_option) : ?>
|
||||
<?php
|
||||
$sort_url = add_query_arg(array_filter([
|
||||
'orderby' => $sort_option['args']['orderby'],
|
||||
'order' => $sort_option['args']['order'],
|
||||
'paged' => false,
|
||||
], static function ($value): bool {
|
||||
return false !== $value;
|
||||
}));
|
||||
if ($sort_key === 'relevance') {
|
||||
$sort_url = remove_query_arg(['orderby', 'order', 'paged']);
|
||||
}
|
||||
?>
|
||||
<a class="search-page-filters__chip<?php echo $current_sort === $sort_key ? ' is-active' : ''; ?>" href="<?php echo esc_url($sort_url); ?>">
|
||||
<?php echo esc_html($sort_option['label']); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="search-page-toolbar" aria-label="<?php esc_attr_e('搜索状态', 'aksrt'); ?>">
|
||||
<span class="search-page-toolbar__count"><?php printf(esc_html(_n('%d 条结果', '%d 条结果', $search_count, 'aksrt')), $search_count); ?></span>
|
||||
<?php if ($has_search_query) : ?>
|
||||
<a class="search-page-toolbar__reset" href="<?php echo esc_url(home_url('/')); ?>"><?php esc_html_e('清除条件', 'aksrt'); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if ($loop_query->have_posts()) : ?>
|
||||
<?php aksrt_render_post_list($loop_query, array_merge($render_config, ['wrapper_class' => 'content-stream__list'])); ?>
|
||||
<div class="content-stream__footer">
|
||||
<?php aksrt_render_pagination($loop_query, ['query_context' => 'search', 'render_config' => $render_config]); ?>
|
||||
</div>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
<?php else : ?>
|
||||
<div class="no-results search-page-empty content-stream__empty">
|
||||
<p class="search-page-empty__icon" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg></p>
|
||||
<h2><?php esc_html_e('未找到相关内容', 'aksrt'); ?></h2>
|
||||
<p class="search-page-empty__text"><?php esc_html_e('换一个更具体的关键词,或者从常用入口继续浏览。', 'aksrt'); ?></p>
|
||||
<div class="search-page-empty__tips">
|
||||
<span><?php esc_html_e('建议:', 'aksrt'); ?></span>
|
||||
<span><?php esc_html_e('减少修饰词', 'aksrt'); ?></span>
|
||||
<span><?php esc_html_e('尝试文章标题中的核心名词', 'aksrt'); ?></span>
|
||||
<span><?php esc_html_e('改用更短的关键词', 'aksrt'); ?></span>
|
||||
</div>
|
||||
<div class="search-page-empty__actions">
|
||||
<a class="btn-outline" href="<?php echo esc_url(home_url('/')); ?>"><?php esc_html_e('返回首页', 'aksrt'); ?></a>
|
||||
<?php if (!empty($popular_categories)) : ?>
|
||||
<?php foreach ($popular_categories as $category) : ?>
|
||||
<a class="search-page-empty__chip" href="<?php echo esc_url(get_category_link($category->term_id)); ?>"><?php echo esc_html($category->name); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<?php if (is_active_sidebar('search_bottom_content')) { dynamic_sidebar('search_bottom_content'); } ?>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user