fix(widgets): render article sidebar by viewport CSS

This commit is contained in:
2026-08-14 12:39:37 +08:00
parent 224797cc39
commit f8dd319524
3 changed files with 9 additions and 4 deletions
+4 -2
View File
@@ -106,8 +106,10 @@ if (!function_exists('aksrt_single_build_context')) :
$has_article_widgets = is_active_sidebar('all_sidebar_top')
|| is_active_sidebar('sidebar-article')
|| is_active_sidebar('all_sidebar_bottom');
$show_aside = !wp_is_mobile()
&& get_post_type($post_id) === 'post'
// Do not use wp_is_mobile() as a layout gate. It is User-Agent based and
// can disagree with the actual viewport (for example, desktop-mode mobile
// browsers). The responsive stylesheet owns narrow-screen hiding.
$show_aside = get_post_type($post_id) === 'post'
&& $layout !== 'no_sidebar'
&& $has_article_widgets;