fix(layout): pass term object to archive settings
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
fbb53c6890
commit
7a8279f8e7
2 files changed
+5
-3
No files matched your search
@@ -195,9 +195,9 @@ function jio_is_show_sidebar_filter(): bool {
|
|||||||
|
|
||||||
// Category/tag term meta can still force off (existing Jio contract).
|
// 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')) {
|
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();
|
$term = get_queried_object();
|
||||||
if ($term_id > 0) {
|
if ($term instanceof \WP_Term) {
|
||||||
$resolved = \Jio\Core\TermMeta::resolve_archive_settings($term_id);
|
$resolved = \Jio\Core\TermMeta::resolve_archive_settings($term);
|
||||||
if (is_array($resolved) && array_key_exists('show_sidebar', $resolved) && empty($resolved['show_sidebar'])) {
|
if (is_array($resolved) && array_key_exists('show_sidebar', $resolved) && empty($resolved['show_sidebar'])) {
|
||||||
return false;
|
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.
|
// (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.match(layout, /if \(!jio_has_current_sidebar_widgets\(\)\) \{\s*return false;/);
|
||||||
assert.doesNotMatch(layout, /is_single\(\) && !jio_has_current_sidebar_widgets/);
|
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
|
// The resolver must answer home_sidebar before the is_page() branch so a
|
||||||
// static front page is checked against the zones the homepage renders.
|
// static front page is checked against the zones the homepage renders.
|
||||||
|
|||||||
Reference in new issue
Block a user