fix(layout): pass term object to archive settings

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Opus 5 committed 2026-11-06 00:00:17 +08:00
1 parent fbb53c6890
commit 7a8279f8e7
2 files changed
+5 -3

No files matched your search

+3 -3
View File
@@ -195,9 +195,9 @@ function jio_is_show_sidebar_filter(): bool {
// Category/tag term meta can still force off (existing Jio contract).
if ((is_category() || is_tag()) && class_exists('\Jio\Core\TermMeta') && method_exists('\Jio\Core\TermMeta', 'resolve_archive_settings')) {
$term_id = (int) get_queried_object_id();
if ($term_id > 0) {
$resolved = \Jio\Core\TermMeta::resolve_archive_settings($term_id);
$term = get_queried_object();
if ($term instanceof \WP_Term) {
$resolved = \Jio\Core\TermMeta::resolve_archive_settings($term);
if (is_array($resolved) && array_key_exists('show_sidebar', $resolved) && empty($resolved['show_sidebar'])) {
return false;
}
@@ -413,6 +413,8 @@ test('every scene reserves a sidebar column only when its widget stack has conte
// (home/category/tag/search/page/archive) to no-sidebar, not just singles.
assert.match(layout, /if \(!jio_has_current_sidebar_widgets\(\)\) \{\s*return false;/);
assert.doesNotMatch(layout, /is_single\(\) && !jio_has_current_sidebar_widgets/);
assert.match(layout, /\$term = get_queried_object\(\);[\s\S]*?\$term instanceof \\WP_Term[\s\S]*?resolve_archive_settings\(\$term\)/);
assert.doesNotMatch(layout, /resolve_archive_settings\(\$term_id\)/);
// The resolver must answer home_sidebar before the is_page() branch so a
// static front page is checked against the zones the homepage renders.