Merge pull request '对齐内容主线页骨架' (#4) from worktree-b2-content-pages-r1 into main
Reviewed-on: CYL/wordpress-theme-aksrt#4
This commit is contained in:
+24
-17
@@ -63,27 +63,34 @@ if (is_author()) {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<main id="main-content" class="site-main content-shell" tabindex="-1">
|
<main id="main-content" class="site-main content-shell content-shell--stream" tabindex="-1">
|
||||||
<div class="content-layout<?php echo $has_sidebar ? '' : ' content-layout--no-sidebar'; ?>">
|
<div class="content-layout<?php echo $has_sidebar ? '' : ' content-layout--no-sidebar'; ?>">
|
||||||
<div class="content-layout__primary">
|
<div class="content-layout__primary">
|
||||||
|
<div class="content-main content-main--archive">
|
||||||
|
<?php if (function_exists('aksrt_breadcrumbs')) { aksrt_breadcrumbs(); } ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$admin_link = function_exists('aksrt_render_admin_quick_link') ? aksrt_render_admin_quick_link('post-list/list', __('列表样式设置', 'aksrt')) : '';
|
$admin_link = function_exists('aksrt_render_admin_quick_link') ? aksrt_render_admin_quick_link('post-list/list', __('列表样式设置', 'aksrt')) : '';
|
||||||
set_query_var('aksrt_ph_eyebrow', __('内容归档', 'aksrt'));
|
set_query_var('aksrt_ph_eyebrow', __('内容归档', 'aksrt'));
|
||||||
set_query_var('aksrt_ph_title', get_the_archive_title());
|
set_query_var('aksrt_ph_title', get_the_archive_title());
|
||||||
set_query_var('aksrt_ph_desc', $archive_summary);
|
set_query_var('aksrt_ph_desc', $archive_summary);
|
||||||
set_query_var('aksrt_ph_extra', $admin_link);
|
set_query_var('aksrt_ph_extra', $admin_link);
|
||||||
get_template_part('templates/parts/page-header');
|
get_template_part('templates/parts/page-header');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if (have_posts()) : ?>
|
<section class="content-stream content-stream--archive" data-page-kind="archive" data-render-mode="<?php echo esc_attr((string) $render_config['mode']); ?>" data-card-style="<?php echo esc_attr((string) $render_config['card_style']); ?>">
|
||||||
<?php aksrt_render_post_list(null, $render_config); ?>
|
<?php if (have_posts()) : ?>
|
||||||
<?php aksrt_render_pagination(null, ['query_context' => 'archive', 'render_config' => $render_config]); ?>
|
<?php aksrt_render_post_list(null, array_merge($render_config, ['wrapper_class' => 'content-stream__list'])); ?>
|
||||||
<?php else : ?>
|
<div class="content-stream__footer">
|
||||||
<div class="no-results">
|
<?php aksrt_render_pagination(null, ['query_context' => 'archive', 'render_config' => $render_config]); ?>
|
||||||
<p><?php esc_html_e('暂无文章', 'aksrt'); ?></p>
|
</div>
|
||||||
</div>
|
<?php else : ?>
|
||||||
<?php endif; ?>
|
<div class="no-results content-stream__empty">
|
||||||
|
<p><?php esc_html_e('暂无文章', 'aksrt'); ?></p>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($has_sidebar) : ?>
|
<?php if ($has_sidebar) : ?>
|
||||||
|
|||||||
@@ -1,11 +1,34 @@
|
|||||||
/* ========== 面包屑 — 对齐 zibll .breadcrumb ========== */
|
/* ========== 面包屑 — 对齐 zibll .breadcrumb ========== */
|
||||||
|
.breadcrumbs-wrap {
|
||||||
|
margin-bottom: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
.breadcrumbs {
|
.breadcrumbs {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: var(--muted-2-color, #999);
|
color: var(--muted-2-color, #999);
|
||||||
margin-bottom: 12px;
|
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.breadcrumbs__item {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumbs__item a,
|
||||||
|
.breadcrumbs__item span {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
.breadcrumbs a {
|
.breadcrumbs a {
|
||||||
color: var(--muted-2-color, #999);
|
color: var(--muted-2-color, #999);
|
||||||
}
|
}
|
||||||
@@ -23,6 +46,10 @@
|
|||||||
.breadcrumbs {
|
.breadcrumbs {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.breadcrumbs-wrap {
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 封面内面包屑 */
|
/* 封面内面包屑 */
|
||||||
@@ -33,6 +60,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ========== 主布局 ========== */
|
/* ========== 主布局 ========== */
|
||||||
|
.content-main {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-main--single {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.content-shell {
|
.content-shell {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
@@ -348,6 +383,45 @@
|
|||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.content-stream {
|
||||||
|
display: grid;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-main--archive,
|
||||||
|
.content-main--tag,
|
||||||
|
.content-main--category,
|
||||||
|
.content-main--search,
|
||||||
|
.content-main--single {
|
||||||
|
display: grid;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-stream__list {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-stream__footer {
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-stream__footer > .content-stream__footer-nav,
|
||||||
|
.archive__ajax-wrap > .content-stream__footer-nav {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-stream__empty {
|
||||||
|
padding: 28px 24px;
|
||||||
|
border-radius: var(--radius-lg);
|
||||||
|
background: var(--surface-1);
|
||||||
|
border: 1px solid var(--color-line-soft, rgba(15, 23, 42, 0.08));
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-shell {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
/* AJAX 筛选加载状态 */
|
/* AJAX 筛选加载状态 */
|
||||||
.archive__ajax-wrap {
|
.archive__ajax-wrap {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -1,4 +1,15 @@
|
|||||||
/* ========== 分页 — 对齐 zibll pagination ========== */
|
/* ========== 分页 — 对齐 zibll pagination ========== */
|
||||||
|
.content-stream__footer-nav {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-stream__footer-nav.aksrt-pagination,
|
||||||
|
.content-stream__footer-nav.aksrt-pagination-ajax,
|
||||||
|
.content-stream__footer .aksrt-pagination,
|
||||||
|
.content-stream__footer .aksrt-pagination-ajax {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.pagination,
|
.pagination,
|
||||||
.aksrt-pagination,
|
.aksrt-pagination,
|
||||||
.navigation.pagination .nav-links,
|
.navigation.pagination .nav-links,
|
||||||
|
|||||||
@@ -129,11 +129,21 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
margin-bottom: 24px;
|
margin-bottom: 0;
|
||||||
padding-bottom: 12px;
|
padding-bottom: 14px;
|
||||||
border-bottom: 1px solid var(--color-line);
|
border-bottom: 1px solid var(--color-line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-page-filters {
|
||||||
|
display: grid;
|
||||||
|
gap: 14px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 16px 18px;
|
||||||
|
border: 1px solid var(--color-line);
|
||||||
|
border-radius: var(--radius-lg);
|
||||||
|
background: var(--surface-2);
|
||||||
|
}
|
||||||
|
|
||||||
.search-page-toolbar__count {
|
.search-page-toolbar__count {
|
||||||
color: var(--color-ink-3);
|
color: var(--color-ink-3);
|
||||||
}
|
}
|
||||||
|
|||||||
+40
-26
@@ -4,17 +4,19 @@
|
|||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function initArchiveFilter() {
|
function initArchiveFilter(root) {
|
||||||
var bar = document.querySelector(".archive-filter-bar--ajax[data-ajax-archive]");
|
var scope = root || document;
|
||||||
|
var bar = scope.querySelector(".archive-filter-bar--ajax[data-ajax-archive]");
|
||||||
if (!bar) return;
|
if (!bar) return;
|
||||||
|
|
||||||
var archiveType = bar.dataset.ajaxArchive || "category";
|
var archiveType = bar.dataset.ajaxArchive || "category";
|
||||||
var termId = parseInt(bar.dataset.termId, 10) || 0;
|
var termId = parseInt(bar.dataset.termId, 10) || 0;
|
||||||
var wrap = document.querySelector("[data-ajax-wrap]");
|
var wrap = scope.querySelector("[data-ajax-wrap]");
|
||||||
if (!wrap) return;
|
if (!wrap) return;
|
||||||
|
|
||||||
var loading = wrap.querySelector(".archive__ajax-loading");
|
var loading = wrap.querySelector(".archive__ajax-loading");
|
||||||
var REST_BASE = "/wp-json/aksrt/v1/archive/posts";
|
var REST_BASE = "/wp-json/aksrt/v1/archive/posts";
|
||||||
|
var emptyText = archiveType === "tag" ? "该标签下暂无文章" : "该分类下暂无文章";
|
||||||
|
|
||||||
var state = {
|
var state = {
|
||||||
filter_cat: "",
|
filter_cat: "",
|
||||||
@@ -24,14 +26,12 @@
|
|||||||
cf: {}
|
cf: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Read initial state from active chips
|
|
||||||
var activeCat = bar.querySelector("[data-filter-cat].is-active");
|
var activeCat = bar.querySelector("[data-filter-cat].is-active");
|
||||||
if (activeCat) state.filter_cat = activeCat.dataset.filterCat || "";
|
if (activeCat) state.filter_cat = activeCat.dataset.filterCat || "";
|
||||||
var activeTag = bar.querySelector("[data-filter-tag].is-active");
|
var activeTag = bar.querySelector("[data-filter-tag].is-active");
|
||||||
if (activeTag) state.filter_tag = activeTag.dataset.filterTag || "";
|
if (activeTag) state.filter_tag = activeTag.dataset.filterTag || "";
|
||||||
var activeSort = bar.querySelector("[data-filter-sort].is-active");
|
var activeSort = bar.querySelector("[data-filter-sort].is-active");
|
||||||
if (activeSort) state.sort = activeSort.dataset.filterSort || "latest";
|
if (activeSort) state.sort = activeSort.dataset.filterSort || "latest";
|
||||||
// custom_filter: read initial cf state from active chips
|
|
||||||
bar.querySelectorAll("[data-filter-cf].is-active").forEach(function (el) {
|
bar.querySelectorAll("[data-filter-cf].is-active").forEach(function (el) {
|
||||||
var dimKey = el.dataset.filterCf || "";
|
var dimKey = el.dataset.filterCf || "";
|
||||||
var dimVal = el.dataset.filterCfVal || "";
|
var dimVal = el.dataset.filterCfVal || "";
|
||||||
@@ -50,11 +50,13 @@
|
|||||||
params.set("sort", s ? s.orderby : "date");
|
params.set("sort", s ? s.orderby : "date");
|
||||||
params.set("order", s ? s.order : "DESC");
|
params.set("order", s ? s.order : "DESC");
|
||||||
params.set("page", String(state.page));
|
params.set("page", String(state.page));
|
||||||
// custom_filter: pass active dimensions as JSON
|
|
||||||
var cfActive = {};
|
var cfActive = {};
|
||||||
var hasCf = false;
|
var hasCf = false;
|
||||||
for (var cfK in state.cf) {
|
for (var cfK in state.cf) {
|
||||||
if (state.cf[cfK]) { cfActive[cfK] = state.cf[cfK]; hasCf = true; }
|
if (state.cf[cfK]) {
|
||||||
|
cfActive[cfK] = state.cf[cfK];
|
||||||
|
hasCf = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (hasCf) params.set("custom_filters", JSON.stringify(cfActive));
|
if (hasCf) params.set("custom_filters", JSON.stringify(cfActive));
|
||||||
return REST_BASE + "?" + params.toString();
|
return REST_BASE + "?" + params.toString();
|
||||||
@@ -70,7 +72,6 @@
|
|||||||
bar.querySelectorAll("[data-filter-sort]").forEach(function (el) {
|
bar.querySelectorAll("[data-filter-sort]").forEach(function (el) {
|
||||||
el.classList.toggle("is-active", (el.dataset.filterSort || "latest") === state.sort);
|
el.classList.toggle("is-active", (el.dataset.filterSort || "latest") === state.sort);
|
||||||
});
|
});
|
||||||
// custom_filter: update cf chip active state
|
|
||||||
bar.querySelectorAll("[data-filter-cf]").forEach(function (el) {
|
bar.querySelectorAll("[data-filter-cf]").forEach(function (el) {
|
||||||
var dimKey = el.dataset.filterCf || "";
|
var dimKey = el.dataset.filterCf || "";
|
||||||
var dimVal = el.dataset.filterCfVal || "";
|
var dimVal = el.dataset.filterCfVal || "";
|
||||||
@@ -89,6 +90,13 @@
|
|||||||
wrap.classList.remove("is-loading");
|
wrap.classList.remove("is-loading");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function rebuildEmptyState() {
|
||||||
|
var noResults = document.createElement("div");
|
||||||
|
noResults.className = "no-results content-stream__empty";
|
||||||
|
noResults.innerHTML = "<p>" + emptyText + "</p>";
|
||||||
|
wrap.appendChild(noResults);
|
||||||
|
}
|
||||||
|
|
||||||
function fetchPosts(pushState) {
|
function fetchPosts(pushState) {
|
||||||
showLoading();
|
showLoading();
|
||||||
fetch(buildUrl(), {
|
fetch(buildUrl(), {
|
||||||
@@ -103,7 +111,6 @@
|
|||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
hideLoading();
|
hideLoading();
|
||||||
if (data.html !== undefined) {
|
if (data.html !== undefined) {
|
||||||
// Keep the loading element, replace the rest
|
|
||||||
var children = Array.from(wrap.children);
|
var children = Array.from(wrap.children);
|
||||||
children.forEach(function (child) {
|
children.forEach(function (child) {
|
||||||
if (child !== loading) wrap.removeChild(child);
|
if (child !== loading) wrap.removeChild(child);
|
||||||
@@ -113,13 +120,9 @@
|
|||||||
temp.innerHTML = data.html;
|
temp.innerHTML = data.html;
|
||||||
while (temp.firstChild) wrap.appendChild(temp.firstChild);
|
while (temp.firstChild) wrap.appendChild(temp.firstChild);
|
||||||
} else {
|
} else {
|
||||||
var noResults = document.createElement("div");
|
rebuildEmptyState();
|
||||||
noResults.className = "no-results";
|
|
||||||
noResults.innerHTML = "<p>暂无文章</p>";
|
|
||||||
wrap.appendChild(noResults);
|
|
||||||
}
|
}
|
||||||
// Re-init rehydratable modules for new content
|
if (window.AksrtFrontend) AksrtFrontend.rehydrate(wrap, "ajax");
|
||||||
if (window.AksrtFrontend) AksrtFrontend.rehydrate(wrap, 'ajax');
|
|
||||||
}
|
}
|
||||||
if (pushState !== false) {
|
if (pushState !== false) {
|
||||||
var url = new URL(window.location.href);
|
var url = new URL(window.location.href);
|
||||||
@@ -128,18 +131,21 @@
|
|||||||
url.searchParams.delete("paged");
|
url.searchParams.delete("paged");
|
||||||
url.searchParams.delete("aksrt_filter_cat");
|
url.searchParams.delete("aksrt_filter_cat");
|
||||||
url.searchParams.delete("aksrt_filter_tag");
|
url.searchParams.delete("aksrt_filter_tag");
|
||||||
// custom_filter: clean cf params
|
|
||||||
url.searchParams.forEach(function (v, k) {
|
url.searchParams.forEach(function (v, k) {
|
||||||
if (k.indexOf("aksrt_cf_") === 0) url.searchParams.delete(k);
|
if (k.indexOf("aksrt_cf_") === 0) url.searchParams.delete(k);
|
||||||
});
|
});
|
||||||
if (state.filter_cat) url.searchParams.set("aksrt_filter_cat", state.filter_cat);
|
if (state.filter_cat) url.searchParams.set("aksrt_filter_cat", state.filter_cat);
|
||||||
if (state.filter_tag) url.searchParams.set("aksrt_filter_tag", state.filter_tag);
|
if (state.filter_tag) url.searchParams.set("aksrt_filter_tag", state.filter_tag);
|
||||||
// custom_filter: set cf URL params
|
|
||||||
for (var cfK2 in state.cf) {
|
for (var cfK2 in state.cf) {
|
||||||
if (state.cf[cfK2]) url.searchParams.set("aksrt_cf_" + cfK2, state.cf[cfK2]);
|
if (state.cf[cfK2]) url.searchParams.set("aksrt_cf_" + cfK2, state.cf[cfK2]);
|
||||||
}
|
}
|
||||||
if (state.sort === "oldest") { url.searchParams.set("orderby", "date"); url.searchParams.set("order", "asc"); }
|
if (state.sort === "oldest") {
|
||||||
else if (state.sort === "popular") { url.searchParams.set("orderby", "comment_count"); url.searchParams.set("order", "desc"); }
|
url.searchParams.set("orderby", "date");
|
||||||
|
url.searchParams.set("order", "asc");
|
||||||
|
} else if (state.sort === "popular") {
|
||||||
|
url.searchParams.set("orderby", "comment_count");
|
||||||
|
url.searchParams.set("order", "desc");
|
||||||
|
}
|
||||||
if (state.page > 1) url.searchParams.set("paged", String(state.page));
|
if (state.page > 1) url.searchParams.set("paged", String(state.page));
|
||||||
history.pushState({ aksrtArchive: true, state: Object.assign({}, state) }, "", url.toString());
|
history.pushState({ aksrtArchive: true, state: Object.assign({}, state) }, "", url.toString());
|
||||||
}
|
}
|
||||||
@@ -157,17 +163,25 @@
|
|||||||
var changed = false;
|
var changed = false;
|
||||||
if (chip.dataset.filterCat !== undefined) {
|
if (chip.dataset.filterCat !== undefined) {
|
||||||
var newCat = chip.dataset.filterCat;
|
var newCat = chip.dataset.filterCat;
|
||||||
if (newCat !== state.filter_cat) { state.filter_cat = newCat; changed = true; }
|
if (newCat !== state.filter_cat) {
|
||||||
|
state.filter_cat = newCat;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (chip.dataset.filterTag !== undefined) {
|
if (chip.dataset.filterTag !== undefined) {
|
||||||
var newTag = chip.dataset.filterTag;
|
var newTag = chip.dataset.filterTag;
|
||||||
if (newTag !== state.filter_tag) { state.filter_tag = newTag; changed = true; }
|
if (newTag !== state.filter_tag) {
|
||||||
|
state.filter_tag = newTag;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (chip.dataset.filterSort !== undefined) {
|
if (chip.dataset.filterSort !== undefined) {
|
||||||
var newSort = chip.dataset.filterSort || "latest";
|
var newSort = chip.dataset.filterSort || "latest";
|
||||||
if (newSort !== state.sort) { state.sort = newSort; changed = true; }
|
if (newSort !== state.sort) {
|
||||||
|
state.sort = newSort;
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// custom_filter: handle cf chip clicks
|
|
||||||
if (chip.dataset.filterCf !== undefined) {
|
if (chip.dataset.filterCf !== undefined) {
|
||||||
var cfKey = chip.dataset.filterCf;
|
var cfKey = chip.dataset.filterCf;
|
||||||
var cfVal = chip.dataset.filterCfVal || "";
|
var cfVal = chip.dataset.filterCfVal || "";
|
||||||
@@ -184,7 +198,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Pagination within AJAX wrap
|
|
||||||
wrap.addEventListener("click", function (e) {
|
wrap.addEventListener("click", function (e) {
|
||||||
var pageLink = e.target.closest(".pagination a, .nav-links a, a.page-numbers");
|
var pageLink = e.target.closest(".pagination a, .nav-links a, a.page-numbers");
|
||||||
if (!pageLink || !wrap.contains(pageLink)) return;
|
if (!pageLink || !wrap.contains(pageLink)) return;
|
||||||
@@ -199,7 +212,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle browser back/forward
|
|
||||||
window.addEventListener("popstate", function (e) {
|
window.addEventListener("popstate", function (e) {
|
||||||
if (e.state && e.state.aksrtArchive) {
|
if (e.state && e.state.aksrtArchive) {
|
||||||
state = Object.assign(state, e.state.state);
|
state = Object.assign(state, e.state.state);
|
||||||
@@ -209,5 +221,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.AksrtFrontend.register("aksrt-archive-filter", function () { initArchiveFilter(); });
|
window.AksrtFrontend.register("aksrt-archive-filter", function (root) {
|
||||||
|
initArchiveFilter(root);
|
||||||
|
});
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -25,8 +25,13 @@
|
|||||||
var loading = false;
|
var loading = false;
|
||||||
var loadMoreBtn = container.querySelector(".aksrt-load-more-btn, .ajax-next");
|
var loadMoreBtn = container.querySelector(".aksrt-load-more-btn, .ajax-next");
|
||||||
var indicator = container.querySelector(".aksrt-loading-indicator");
|
var indicator = container.querySelector(".aksrt-loading-indicator");
|
||||||
// 目标容器:文章列表取 .post-grid,评论取 .comment-list
|
|
||||||
var target = container.previousElementSibling;
|
var target = container.previousElementSibling;
|
||||||
|
if (target && target.classList && target.classList.contains("content-stream__footer")) {
|
||||||
|
target = target.previousElementSibling;
|
||||||
|
}
|
||||||
|
if (!target && container.parentElement) {
|
||||||
|
target = container.parentElement.querySelector(".post-grid, .comment-list, .content-stream__list");
|
||||||
|
}
|
||||||
|
|
||||||
function showSkeleton() {
|
function showSkeleton() {
|
||||||
if (!target) return;
|
if (!target) return;
|
||||||
@@ -96,10 +101,8 @@
|
|||||||
nextPage++;
|
nextPage++;
|
||||||
container.dataset.nextPage = String(nextPage);
|
container.dataset.nextPage = String(nextPage);
|
||||||
|
|
||||||
// 重新初始化懒加载(新加载的图片)
|
|
||||||
if (typeof initLazyLoad === "function") initLazyLoad();
|
if (typeof initLazyLoad === "function") initLazyLoad();
|
||||||
|
|
||||||
// 如果没有更多页
|
|
||||||
if (nextPage > maxPages || !res.data.has_more) {
|
if (nextPage > maxPages || !res.data.has_more) {
|
||||||
if (loadMoreBtn) {
|
if (loadMoreBtn) {
|
||||||
loadMoreBtn.textContent = nomoreText;
|
loadMoreBtn.textContent = nomoreText;
|
||||||
@@ -124,7 +127,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载更多按钮点击
|
|
||||||
if (loadMoreBtn) {
|
if (loadMoreBtn) {
|
||||||
loadMoreBtn.addEventListener("click", function(e) {
|
loadMoreBtn.addEventListener("click", function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -154,55 +156,48 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 无限滚动:IntersectionObserver
|
|
||||||
if (mode === "infinite" && "IntersectionObserver" in window) {
|
if (mode === "infinite" && "IntersectionObserver" in window) {
|
||||||
// Comment containers respect commentIasAuto; if disabled, fall back to click-to-load
|
|
||||||
if (isComment && window.aksrtData && aksrtData.commentIasAuto === false) {
|
if (isComment && window.aksrtData && aksrtData.commentIasAuto === false) {
|
||||||
// Skip IntersectionObserver — load_more button already present
|
|
||||||
} else {
|
} else {
|
||||||
var sentinel = document.createElement("div");
|
var sentinel = document.createElement("div");
|
||||||
sentinel.className = "aksrt-scroll-sentinel";
|
sentinel.className = "aksrt-scroll-sentinel";
|
||||||
container.appendChild(sentinel);
|
container.appendChild(sentinel);
|
||||||
var lazyloadAction = container.dataset.lazyloadAction || "";
|
var lazyloadAction = container.dataset.lazyloadAction || "";
|
||||||
var iasMax = isComment
|
var iasMax = isComment
|
||||||
? ((window.aksrtData && typeof aksrtData.commentIasMax !== "undefined") ? parseInt(aksrtData.commentIasMax, 10) : 0)
|
? ((window.aksrtData && typeof aksrtData.commentIasMax !== "undefined") ? parseInt(aksrtData.commentIasMax, 10) : 0)
|
||||||
: ((window.aksrtData && typeof aksrtData.iasMax !== "undefined") ? parseInt(aksrtData.iasMax, 10) : 0);
|
: ((window.aksrtData && typeof aksrtData.iasMax !== "undefined") ? parseInt(aksrtData.iasMax, 10) : 0);
|
||||||
var initialPage = nextPage - 1; // page at init time
|
var initialPage = nextPage - 1;
|
||||||
var observer = new IntersectionObserver(
|
var observer = new IntersectionObserver(
|
||||||
function (entries) {
|
function (entries) {
|
||||||
if (entries[0].isIntersecting && !loading) {
|
if (entries[0].isIntersecting && !loading) {
|
||||||
// iasMax = 0 means unlimited, otherwise limit additional pages
|
if (iasMax > 0 && (nextPage - initialPage) >= iasMax) {
|
||||||
if (iasMax > 0 && (nextPage - initialPage) >= iasMax) {
|
observer.disconnect();
|
||||||
// Reached ias max, show nomore and disconnect
|
if (loadMoreBtn) {
|
||||||
observer.disconnect();
|
loadMoreBtn.textContent = nomoreText;
|
||||||
if (loadMoreBtn) {
|
loadMoreBtn.classList.add("ajax-nomore");
|
||||||
loadMoreBtn.textContent = nomoreText;
|
loadMoreBtn.style.pointerEvents = "none";
|
||||||
loadMoreBtn.classList.add("ajax-nomore");
|
}
|
||||||
loadMoreBtn.style.pointerEvents = "none";
|
return;
|
||||||
}
|
}
|
||||||
return;
|
loadNextPage();
|
||||||
}
|
}
|
||||||
loadNextPage();
|
},
|
||||||
}
|
{ rootMargin: "400px" }
|
||||||
},
|
);
|
||||||
{ rootMargin: "400px" }
|
if (lazyloadAction === "ias") {
|
||||||
);
|
container.classList.add("ias-pending");
|
||||||
if (lazyloadAction === "ias") {
|
}
|
||||||
container.classList.add("ias-pending");
|
observer.observe(sentinel);
|
||||||
}
|
|
||||||
observer.observe(sentinel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ====== 图片懒加载 ====== */
|
|
||||||
function initLazyLoad(root) {
|
function initLazyLoad(root) {
|
||||||
var scope = root || document;
|
var scope = root || document;
|
||||||
var lazyImages = scope.querySelectorAll("img.aksrt-lazy");
|
var lazyImages = scope.querySelectorAll("img.aksrt-lazy");
|
||||||
if (!lazyImages.length) return;
|
if (!lazyImages.length) return;
|
||||||
|
|
||||||
// 不支持 IntersectionObserver 时直接加载所有图片
|
|
||||||
if (!("IntersectionObserver" in window)) {
|
if (!("IntersectionObserver" in window)) {
|
||||||
lazyImages.forEach(function (img) {
|
lazyImages.forEach(function (img) {
|
||||||
var src = img.dataset.src;
|
var src = img.dataset.src;
|
||||||
@@ -230,13 +225,11 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建新图片预加载
|
|
||||||
var tempImg = new Image();
|
var tempImg = new Image();
|
||||||
tempImg.onload = function () {
|
tempImg.onload = function () {
|
||||||
img.src = src;
|
img.src = src;
|
||||||
img.classList.remove("aksrt-lazy");
|
img.classList.remove("aksrt-lazy");
|
||||||
img.classList.add("aksrt-loaded");
|
img.classList.add("aksrt-loaded");
|
||||||
// 移除骨架
|
|
||||||
var skeleton = img.previousElementSibling;
|
var skeleton = img.previousElementSibling;
|
||||||
if (skeleton && skeleton.classList.contains("aksrt-skeleton")) {
|
if (skeleton && skeleton.classList.contains("aksrt-skeleton")) {
|
||||||
skeleton.remove();
|
skeleton.remove();
|
||||||
@@ -245,7 +238,6 @@
|
|||||||
tempImg.onerror = function () {
|
tempImg.onerror = function () {
|
||||||
img.classList.remove("aksrt-lazy");
|
img.classList.remove("aksrt-lazy");
|
||||||
img.classList.add("aksrt-error");
|
img.classList.add("aksrt-error");
|
||||||
// 移除骨架
|
|
||||||
var skeleton = img.previousElementSibling;
|
var skeleton = img.previousElementSibling;
|
||||||
if (skeleton && skeleton.classList.contains("aksrt-skeleton")) {
|
if (skeleton && skeleton.classList.contains("aksrt-skeleton")) {
|
||||||
skeleton.remove();
|
skeleton.remove();
|
||||||
|
|||||||
+33
-23
@@ -142,26 +142,34 @@ if ($ajax_filter && !empty($filter_settings['cat_show_tag'])) {
|
|||||||
|
|
||||||
<?php if (is_active_sidebar('cat_top_content')) { dynamic_sidebar('cat_top_content'); } ?>
|
<?php if (is_active_sidebar('cat_top_content')) { dynamic_sidebar('cat_top_content'); } ?>
|
||||||
|
|
||||||
<?php if ($header_style !== 'none') : ?>
|
<div class="content-main content-main--archive content-main--category">
|
||||||
<header class="page-header term-page-header term-page-header--<?php echo esc_attr($header_style); ?>">
|
<?php if (function_exists('aksrt_breadcrumbs')) { aksrt_breadcrumbs(); } ?>
|
||||||
<div class="term-page-header__body">
|
|
||||||
<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'])) : ?>
|
|
||||||
<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))) : ?>
|
<?php if ($header_style !== 'none') : ?>
|
||||||
<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; ?>"<?php endif; ?>>
|
<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; ?>
|
||||||
|
|
||||||
|
<?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)) : ?>
|
<?php if (!empty($filter_terms)) : ?>
|
||||||
<div class="archive-filter-bar__main">
|
<div class="archive-filter-bar__main">
|
||||||
<span class="archive-filter-bar__label"><?php esc_html_e('分类导航', 'aksrt'); ?></span>
|
<span class="archive-filter-bar__label"><?php esc_html_e('分类导航', 'aksrt'); ?></span>
|
||||||
@@ -226,13 +234,15 @@ if ($ajax_filter && !empty($filter_settings['cat_show_tag'])) {
|
|||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="archive__ajax-wrap"<?php if ($ajax_filter) : ?> data-ajax-wrap<?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>
|
<div class="archive__ajax-loading" aria-hidden="true"><span class="archive__ajax-spinner"></span></div>
|
||||||
<?php if (have_posts()) : ?>
|
<?php if (have_posts()) : ?>
|
||||||
<?php aksrt_render_post_list(null, $render_config); ?>
|
<?php aksrt_render_post_list(null, array_merge($render_config, ['wrapper_class' => 'content-stream__list'])); ?>
|
||||||
<?php aksrt_render_pagination(null, ['query_context' => 'archive', 'render_config' => $render_config]); ?>
|
<div class="content-stream__footer">
|
||||||
|
<?php aksrt_render_pagination(null, ['query_context' => 'archive', 'render_config' => $render_config]); ?>
|
||||||
|
</div>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<div class="no-results">
|
<div class="no-results content-stream__empty">
|
||||||
<p><?php esc_html_e('该分类下暂无文章', 'aksrt'); ?></p>
|
<p><?php esc_html_e('该分类下暂无文章', 'aksrt'); ?></p>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|||||||
@@ -303,34 +303,52 @@ if (!function_exists('aksrt_breadcrumbs')) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
$items[] = '<li><a href="' . esc_url(home_url('/')) . '"><i class="fa fa-map-marker" aria-hidden="true"></i> ' . esc_html($home_text) . '</a></li>';
|
$items[] = '<li class="breadcrumbs__item breadcrumbs__item--home"><a href="' . esc_url(home_url('/')) . '"><i class="fa fa-map-marker" aria-hidden="true"></i><span>' . esc_html($home_text) . '</span></a></li>';
|
||||||
|
|
||||||
if (is_category()) {
|
if (is_category()) {
|
||||||
$items[] = '<li>' . esc_html(single_cat_title('', false)) . '</li>';
|
$term = get_queried_object();
|
||||||
|
if ($term instanceof WP_Term) {
|
||||||
|
$ancestors = array_reverse(get_ancestors($term->term_id, 'category'));
|
||||||
|
foreach ($ancestors as $ancestor_id) {
|
||||||
|
$ancestor = get_term($ancestor_id, 'category');
|
||||||
|
if ($ancestor instanceof WP_Term && !is_wp_error($ancestor)) {
|
||||||
|
$items[] = '<li class="breadcrumbs__item"><a href="' . esc_url(get_category_link($ancestor->term_id)) . '">' . esc_html($ancestor->name) . '</a></li>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$items[] = '<li class="breadcrumbs__item is-current"><span>' . esc_html(single_cat_title('', false)) . '</span></li>';
|
||||||
|
}
|
||||||
} elseif (is_tag()) {
|
} elseif (is_tag()) {
|
||||||
$items[] = '<li>' . esc_html(single_tag_title('', false)) . '</li>';
|
$items[] = '<li class="breadcrumbs__item is-current"><span>' . esc_html(single_tag_title('', false)) . '</span></li>';
|
||||||
} elseif (is_author()) {
|
} elseif (is_author()) {
|
||||||
$items[] = '<li>' . esc_html(get_the_author()) . '</li>';
|
$items[] = '<li class="breadcrumbs__item is-current"><span>' . esc_html(get_the_author()) . '</span></li>';
|
||||||
} elseif (is_search()) {
|
} elseif (is_search()) {
|
||||||
$items[] = '<li>' . esc_html__('搜索', 'aksrt') . '</li>';
|
$search_query = trim((string) get_search_query());
|
||||||
|
$items[] = '<li class="breadcrumbs__item is-current"><span>' . esc_html($search_query !== '' ? sprintf(__('搜索:%s', 'aksrt'), $search_query) : __('搜索', 'aksrt')) . '</span></li>';
|
||||||
} elseif (function_exists('aksrt_is_resource_archive') && aksrt_is_resource_archive()) {
|
} elseif (function_exists('aksrt_is_resource_archive') && aksrt_is_resource_archive()) {
|
||||||
$items[] = '<li>' . esc_html__('资源', 'aksrt') . '</li>';
|
$items[] = '<li class="breadcrumbs__item is-current"><span>' . esc_html__('资源', 'aksrt') . '</span></li>';
|
||||||
} elseif (is_singular('post')) {
|
} elseif (is_singular('post')) {
|
||||||
$cats = get_the_category();
|
$cats = get_the_category();
|
||||||
if (!empty($cats)) {
|
if (!empty($cats)) {
|
||||||
$category = $cats[0];
|
$category = $cats[0];
|
||||||
$items[] = '<li><a href="' . esc_url(get_category_link($category->term_id)) . '">' . esc_html($category->name) . '</a></li>';
|
$ancestors = array_reverse(get_ancestors($category->term_id, 'category'));
|
||||||
|
foreach ($ancestors as $ancestor_id) {
|
||||||
|
$ancestor = get_term($ancestor_id, 'category');
|
||||||
|
if ($ancestor instanceof WP_Term && !is_wp_error($ancestor)) {
|
||||||
|
$items[] = '<li class="breadcrumbs__item"><a href="' . esc_url(get_category_link($ancestor->term_id)) . '">' . esc_html($ancestor->name) . '</a></li>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$items[] = '<li class="breadcrumbs__item"><a href="' . esc_url(get_category_link($category->term_id)) . '">' . esc_html($category->name) . '</a></li>';
|
||||||
}
|
}
|
||||||
$items[] = '<li>' . esc_html(get_the_title()) . '</li>';
|
$items[] = '<li class="breadcrumbs__item is-current"><span>' . esc_html(get_the_title()) . '</span></li>';
|
||||||
} elseif (is_page()) {
|
} elseif (is_page()) {
|
||||||
$items[] = '<li>' . esc_html(get_the_title()) . '</li>';
|
$items[] = '<li class="breadcrumbs__item is-current"><span>' . esc_html(get_the_title()) . '</span></li>';
|
||||||
} elseif (is_archive()) {
|
} elseif (is_archive()) {
|
||||||
$items[] = '<li>' . esc_html(get_the_archive_title()) . '</li>';
|
$items[] = '<li class="breadcrumbs__item is-current"><span>' . esc_html(get_the_archive_title()) . '</span></li>';
|
||||||
} else {
|
} else {
|
||||||
$items[] = '<li>' . esc_html(get_the_title()) . '</li>';
|
$items[] = '<li class="breadcrumbs__item is-current"><span>' . esc_html(get_the_title()) . '</span></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<ul class="breadcrumb">' . implode('', $items) . '</ul>';
|
echo '<nav class="breadcrumbs-wrap" aria-label="' . esc_attr__('面包屑', 'aksrt') . '"><ol class="breadcrumbs breadcrumb">' . implode('<li class="breadcrumbs__sep" aria-hidden="true">/</li>', $items) . '</ol></nav>';
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
|
|||||||
@@ -1014,7 +1014,7 @@ if (!function_exists('aksrt_render_pagination')) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="pagenav ajax-pag aksrt-pagination">';
|
echo '<div class="pagenav ajax-pag aksrt-pagination content-stream__footer-nav">';
|
||||||
echo wp_kses_post($links);
|
echo wp_kses_post($links);
|
||||||
if ($max_pages > 8) {
|
if ($max_pages > 8) {
|
||||||
echo '<span class="pag-jump">';
|
echo '<span class="pag-jump">';
|
||||||
@@ -1057,7 +1057,7 @@ if (!function_exists('aksrt_render_pagination')) {
|
|||||||
|
|
||||||
$trigger_text = (class_exists('AKSRT_Settings') && ($t = AKSRT_Settings::get_post_list_style_settings()['ajax_trigger_text'] ?? '') !== '') ? $t : __('加载更多', 'aksrt');
|
$trigger_text = (class_exists('AKSRT_Settings') && ($t = AKSRT_Settings::get_post_list_style_settings()['ajax_trigger_text'] ?? '') !== '') ? $t : __('加载更多', 'aksrt');
|
||||||
?>
|
?>
|
||||||
<div class="text-center theme-pagination ajax-pag ajax-pagination aksrt-pagination-ajax"
|
<div class="text-center theme-pagination ajax-pag ajax-pagination aksrt-pagination-ajax content-stream__footer-nav"
|
||||||
data-mode="<?php echo esc_attr($pagination_mode); ?>"
|
data-mode="<?php echo esc_attr($pagination_mode); ?>"
|
||||||
data-next-page="<?php echo esc_attr((string) ($current_page + 1)); ?>"
|
data-next-page="<?php echo esc_attr((string) ($current_page + 1)); ?>"
|
||||||
data-max-pages="<?php echo esc_attr((string) $max_pages); ?>"
|
data-max-pages="<?php echo esc_attr((string) $max_pages); ?>"
|
||||||
@@ -1161,7 +1161,7 @@ if (!function_exists('aksrt_render_comment_pagination')) {
|
|||||||
$max_pages = get_comment_pages_count();
|
$max_pages = get_comment_pages_count();
|
||||||
$current_page = max(1, get_query_var('cpage', 1));
|
$current_page = max(1, get_query_var('cpage', 1));
|
||||||
|
|
||||||
echo '<div class="pagenav ajax-pag aksrt-pagination">';
|
echo '<div class="pagenav ajax-pag aksrt-pagination content-stream__footer-nav">';
|
||||||
echo wp_kses_post($pagination_links);
|
echo wp_kses_post($pagination_links);
|
||||||
if ($max_pages > 8) {
|
if ($max_pages > 8) {
|
||||||
echo '<span class="pag-jump">';
|
echo '<span class="pag-jump">';
|
||||||
|
|||||||
+119
-111
@@ -129,124 +129,132 @@ $search_sort_options = [
|
|||||||
<div class="content-layout__primary">
|
<div class="content-layout__primary">
|
||||||
<?php if (is_active_sidebar('search_top_content')) { dynamic_sidebar('search_top_content'); } ?>
|
<?php if (is_active_sidebar('search_top_content')) { dynamic_sidebar('search_top_content'); } ?>
|
||||||
|
|
||||||
<?php
|
<div class="content-main content-main--search">
|
||||||
$search_title = $has_search_query
|
<?php if (function_exists('aksrt_breadcrumbs')) { aksrt_breadcrumbs(); } ?>
|
||||||
? 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');
|
|
||||||
?>
|
|
||||||
|
|
||||||
<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">
|
<?php
|
||||||
<input type="hidden" name="aksrt_search_type" value="<?php echo esc_attr($search_type); ?>">
|
$search_title = $has_search_query
|
||||||
<span class="search-icon search-page-form__icon" aria-hidden="true">
|
? sprintf(esc_html__('搜索”%s”', 'aksrt'), esc_html($search_query))
|
||||||
<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>
|
: esc_html__('搜索内容', 'aksrt');
|
||||||
</span>
|
$search_desc = $has_search_query
|
||||||
<label class="screen-reader-text" for="search-page-input"><?php esc_html_e('搜索', 'aksrt'); ?></label>
|
? sprintf(esc_html__('共找到 %1$d 条与 “%2$s” 相关的内容。', 'aksrt'), $search_count, esc_html($search_query))
|
||||||
<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">
|
: esc_html__('输入关键词,快速查找文章、教程和站内内容。', 'aksrt');
|
||||||
<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>
|
$admin_link = function_exists('aksrt_render_admin_quick_link') ? aksrt_render_admin_quick_link('page-display/other', __('搜索页设置', 'aksrt')) : '';
|
||||||
<button type="submit" class="search-page-form__submit"><?php esc_html_e('搜索', 'aksrt'); ?></button>
|
set_query_var('aksrt_ph_eyebrow', __('站内搜索', 'aksrt'));
|
||||||
</form>
|
set_query_var('aksrt_ph_title', $search_title);
|
||||||
<?php aksrt_render_search_hot_keywords($hot_keywords, 'aksrt-search-hot-keywords'); ?>
|
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'])) : ?>
|
<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']); ?>">
|
||||||
<div class="search-page-filters" aria-label="<?php esc_attr_e('搜索筛选', 'aksrt'); ?>">
|
<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">
|
||||||
<?php if (!empty($search_type_options)) : ?>
|
<input type="hidden" name="aksrt_search_type" value="<?php echo esc_attr($search_type); ?>">
|
||||||
<div class="search-page-filters__group">
|
<span class="search-icon search-page-form__icon" aria-hidden="true">
|
||||||
<span class="search-page-filters__label"><?php esc_html_e('类型', 'aksrt'); ?></span>
|
<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>
|
||||||
<div class="search-page-filters__chips">
|
</span>
|
||||||
<?php foreach ($search_type_options as $type_key => $type_label) : ?>
|
<label class="screen-reader-text" for="search-page-input"><?php esc_html_e('搜索', 'aksrt'); ?></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])); ?>">
|
<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">
|
||||||
<?php echo esc_html($type_label); ?>
|
<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>
|
||||||
</a>
|
<button type="submit" class="search-page-form__submit"><?php esc_html_e('搜索', 'aksrt'); ?></button>
|
||||||
<?php endforeach; ?>
|
</form>
|
||||||
</div>
|
<?php aksrt_render_search_hot_keywords($hot_keywords, 'aksrt-search-hot-keywords'); ?>
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if (!empty($filter_settings['categories']) && !empty($search_categories)) : ?>
|
<?php if (!empty($filter_settings['enabled'])) : ?>
|
||||||
<div class="search-page-filters__group">
|
<div class="search-page-filters" aria-label="<?php esc_attr_e('搜索筛选', 'aksrt'); ?>">
|
||||||
<span class="search-page-filters__label"><?php esc_html_e('分类', 'aksrt'); ?></span>
|
<?php if (!empty($search_type_options)) : ?>
|
||||||
<div class="search-page-filters__select-wrap">
|
<div class="search-page-filters__group">
|
||||||
<select class="search-page-filters__select" id="search-category-filter" aria-label="<?php esc_attr_e('选择分类', 'aksrt'); ?>">
|
<span class="search-page-filters__label"><?php esc_html_e('类型', 'aksrt'); ?></span>
|
||||||
<option value=""><?php esc_html_e('全部分类', 'aksrt'); ?></option>
|
<div class="search-page-filters__chips">
|
||||||
<?php foreach ($search_categories as $cat) : ?>
|
<?php foreach ($search_type_options as $type_key => $type_label) : ?>
|
||||||
<option value="<?php echo esc_attr($cat->term_id); ?>"<?php selected($current_category, $cat->term_id); ?>>
|
<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($cat->name); ?>
|
<?php echo esc_html($type_label); ?>
|
||||||
<?php if ($cat->count > 0) : ?>(<?php echo esc_html((string) $cat->count); ?>)<?php endif; ?>
|
</a>
|
||||||
</option>
|
<?php endforeach; ?>
|
||||||
<?php endforeach; ?>
|
</div>
|
||||||
</select>
|
</div>
|
||||||
</div>
|
<?php endif; ?>
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if (!empty($filter_settings['sort'])) : ?>
|
<?php if (!empty($filter_settings['categories']) && !empty($search_categories)) : ?>
|
||||||
<div class="search-page-filters__group">
|
<div class="search-page-filters__group">
|
||||||
<span class="search-page-filters__label"><?php esc_html_e('排序', 'aksrt'); ?></span>
|
<span class="search-page-filters__label"><?php esc_html_e('分类', 'aksrt'); ?></span>
|
||||||
<div class="search-page-filters__chips">
|
<div class="search-page-filters__select-wrap">
|
||||||
<?php foreach ($search_sort_options as $sort_key => $sort_option) : ?>
|
<select class="search-page-filters__select" id="search-category-filter" aria-label="<?php esc_attr_e('选择分类', 'aksrt'); ?>">
|
||||||
<?php
|
<option value=""><?php esc_html_e('全部分类', 'aksrt'); ?></option>
|
||||||
$sort_url = add_query_arg(array_filter([
|
<?php foreach ($search_categories as $cat) : ?>
|
||||||
'orderby' => $sort_option['args']['orderby'],
|
<option value="<?php echo esc_attr($cat->term_id); ?>"<?php selected($current_category, $cat->term_id); ?>>
|
||||||
'order' => $sort_option['args']['order'],
|
<?php echo esc_html($cat->name); ?>
|
||||||
'paged' => false,
|
<?php if ($cat->count > 0) : ?>(<?php echo esc_html((string) $cat->count); ?>)<?php endif; ?>
|
||||||
], static function ($value): bool {
|
</option>
|
||||||
return false !== $value;
|
<?php endforeach; ?>
|
||||||
}));
|
</select>
|
||||||
if ($sort_key === 'relevance') {
|
</div>
|
||||||
$sort_url = remove_query_arg(['orderby', 'order', 'paged']);
|
</div>
|
||||||
}
|
<?php endif; ?>
|
||||||
?>
|
|
||||||
<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; ?>
|
|
||||||
|
|
||||||
<div class="search-page-toolbar" aria-label="<?php esc_attr_e('搜索状态', 'aksrt'); ?>">
|
<?php if (!empty($filter_settings['sort'])) : ?>
|
||||||
<span class="search-page-toolbar__count"><?php printf(esc_html(_n('%d 条结果', '%d 条结果', $search_count, 'aksrt')), $search_count); ?></span>
|
<div class="search-page-filters__group">
|
||||||
<?php if ($has_search_query) : ?>
|
<span class="search-page-filters__label"><?php esc_html_e('排序', 'aksrt'); ?></span>
|
||||||
<a class="search-page-toolbar__reset" href="<?php echo esc_url(home_url('/')); ?>"><?php esc_html_e('清除条件', 'aksrt'); ?></a>
|
<div class="search-page-filters__chips">
|
||||||
<?php endif; ?>
|
<?php foreach ($search_sort_options as $sort_key => $sort_option) : ?>
|
||||||
</div>
|
<?php
|
||||||
|
$sort_url = add_query_arg(array_filter([
|
||||||
<?php if ($loop_query->have_posts()) : ?>
|
'orderby' => $sort_option['args']['orderby'],
|
||||||
<?php aksrt_render_post_list($loop_query, $render_config); ?>
|
'order' => $sort_option['args']['order'],
|
||||||
<?php aksrt_render_pagination($loop_query, ['query_context' => 'search', 'render_config' => $render_config]); ?>
|
'paged' => false,
|
||||||
<?php wp_reset_postdata(); ?>
|
], static function ($value): bool {
|
||||||
<?php else : ?>
|
return false !== $value;
|
||||||
<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>
|
if ($sort_key === 'relevance') {
|
||||||
<h2><?php esc_html_e('未找到相关内容', 'aksrt'); ?></h2>
|
$sort_url = remove_query_arg(['orderby', 'order', 'paged']);
|
||||||
<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>
|
<a class="search-page-filters__chip<?php echo $current_sort === $sort_key ? ' is-active' : ''; ?>" href="<?php echo esc_url($sort_url); ?>">
|
||||||
<span><?php esc_html_e('减少修饰词', 'aksrt'); ?></span>
|
<?php echo esc_html($sort_option['label']); ?>
|
||||||
<span><?php esc_html_e('尝试文章标题中的核心名词', 'aksrt'); ?></span>
|
</a>
|
||||||
<span><?php esc_html_e('改用更短的关键词', 'aksrt'); ?></span>
|
<?php endforeach; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-page-empty__actions">
|
</div>
|
||||||
<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; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</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'); } ?>
|
<?php if (is_active_sidebar('search_bottom_content')) { dynamic_sidebar('search_bottom_content'); } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+7
-5
@@ -171,14 +171,15 @@ while (have_posts()) :
|
|||||||
<div id="reading-progress-global" class="reading-progress-bar" role="progressbar" aria-label="<?php esc_attr_e('阅读进度', 'aksrt'); ?>" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"></div>
|
<div id="reading-progress-global" class="reading-progress-bar" role="progressbar" aria-label="<?php esc_attr_e('阅读进度', 'aksrt'); ?>" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<main id="main-content" class="site-main container" tabindex="-1">
|
<main id="main-content" class="site-main content-shell content-shell--stream content-shell--single" tabindex="-1">
|
||||||
<div class="content-wrap">
|
|
||||||
<div class="content-layout<?php echo $show_sidebar ? '' : ' content-layout--no-sidebar'; ?>">
|
<div class="content-layout<?php echo $show_sidebar ? '' : ' content-layout--no-sidebar'; ?>">
|
||||||
<div class="content-layout__primary">
|
<div class="content-layout__primary">
|
||||||
|
<div class="content-main content-main--single">
|
||||||
|
<?php if (!$show_cover && function_exists('aksrt_breadcrumbs')) { aksrt_breadcrumbs($single_settings['breadcrumbs_home'] ?? ''); } ?>
|
||||||
|
|
||||||
<?php do_action('aksrt_single_before', $post); ?>
|
<?php do_action('aksrt_single_before', $post); ?>
|
||||||
|
|
||||||
<article <?php post_class('article main-bg theme-box box-body radius8 main-shadow'); ?>>
|
<article <?php post_class('article article-shell main-bg theme-box box-body radius8 main-shadow'); ?>>
|
||||||
<?php
|
<?php
|
||||||
$cover_type = (string) ($single_settings['cover_type'] ?? 'none');
|
$cover_type = (string) ($single_settings['cover_type'] ?? 'none');
|
||||||
$img_scale = (int) ($single_settings['article_image_cover_scale'] ?? 35);
|
$img_scale = (int) ($single_settings['article_image_cover_scale'] ?? 35);
|
||||||
@@ -444,7 +445,8 @@ while (have_posts()) :
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<?php do_action('aksrt_single_article_after', $post); ?>
|
<?php do_action('aksrt_single_article_after', $post); ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($show_sidebar) : ?>
|
<?php if ($show_sidebar) : ?>
|
||||||
|
|||||||
@@ -91,26 +91,34 @@ if ($ajax_filter && !empty($filter_settings['tag_show_cat'])) {
|
|||||||
|
|
||||||
<?php if (is_active_sidebar('tag_top_content')) { dynamic_sidebar('tag_top_content'); } ?>
|
<?php if (is_active_sidebar('tag_top_content')) { dynamic_sidebar('tag_top_content'); } ?>
|
||||||
|
|
||||||
<?php if ($header_style !== 'none') : ?>
|
<div class="content-main content-main--archive content-main--tag">
|
||||||
<header class="page-header term-page-header term-page-header--<?php echo esc_attr($header_style); ?>">
|
<?php if (function_exists('aksrt_breadcrumbs')) { aksrt_breadcrumbs(); } ?>
|
||||||
<div class="term-page-header__body">
|
|
||||||
<div>
|
|
||||||
<p class="term-page-header__eyebrow"><?php esc_html_e('标签归档', 'aksrt'); ?></p>
|
|
||||||
<h1 class="entry-title"><?php single_tag_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/tag', __('标签页设置', 'aksrt')); } ?>
|
|
||||||
</div>
|
|
||||||
<?php if (!empty($archive_settings['show_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($filter_settings['enabled']) && (!empty($filter_settings['sort']) || !empty($cat_filter_terms))) : ?>
|
<?php if ($header_style !== 'none') : ?>
|
||||||
<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="tag" data-term-id="<?php echo (int) $term->term_id; ?>"<?php endif; ?>>
|
<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_tag_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/tag', __('标签页设置', '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; ?>
|
||||||
|
|
||||||
|
<?php if (!empty($filter_settings['enabled']) && (!empty($filter_settings['sort']) || !empty($cat_filter_terms))) : ?>
|
||||||
|
<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="tag" 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($cat_filter_terms)) : ?>
|
<?php if (!empty($cat_filter_terms)) : ?>
|
||||||
<div class="archive-filter-bar__main">
|
<div class="archive-filter-bar__main">
|
||||||
<span class="archive-filter-bar__label"><?php esc_html_e('分类', 'aksrt'); ?></span>
|
<span class="archive-filter-bar__label"><?php esc_html_e('分类', 'aksrt'); ?></span>
|
||||||
@@ -145,13 +153,15 @@ if ($ajax_filter && !empty($filter_settings['tag_show_cat'])) {
|
|||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="archive__ajax-wrap"<?php if ($ajax_filter) : ?> data-ajax-wrap<?php endif; ?>>
|
<div class="archive__ajax-wrap content-stream content-stream--archive content-stream--tag<?php echo $ajax_filter ? ' is-ajax-enabled' : ''; ?>" data-page-kind="tag" 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>
|
<div class="archive__ajax-loading" aria-hidden="true"><span class="archive__ajax-spinner"></span></div>
|
||||||
<?php if (have_posts()) : ?>
|
<?php if (have_posts()) : ?>
|
||||||
<?php aksrt_render_post_list(null, $render_config); ?>
|
<?php aksrt_render_post_list(null, array_merge($render_config, ['wrapper_class' => 'content-stream__list'])); ?>
|
||||||
<?php aksrt_render_pagination(null, ['query_context' => 'archive', 'render_config' => $render_config]); ?>
|
<div class="content-stream__footer">
|
||||||
|
<?php aksrt_render_pagination(null, ['query_context' => 'archive', 'render_config' => $render_config]); ?>
|
||||||
|
</div>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<div class="no-results">
|
<div class="no-results content-stream__empty">
|
||||||
<p><?php esc_html_e('该标签下暂无文章', 'aksrt'); ?></p>
|
<p><?php esc_html_e('该标签下暂无文章', 'aksrt'); ?></p>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user