Files
wordpress-theme-aksrt/inc/helpers/aksrt-single-aside.php
T
2026-08-22 18:54:12 +08:00

37 lines
954 B
PHP

<?php
/**
* Single-post sidebar composition.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
if (!function_exists('aksrt_single_render_aside')) :
/**
* Render the article sidebar: widget areas only, legacy sidebar.php parity.
*
* @param array<string,mixed> $ctx Single context.
*/
function aksrt_single_render_aside(array $ctx): void {
$post_id = (int) ($ctx['post_id'] ?? get_the_ID());
if (get_post_type($post_id) !== 'post') {
return;
}
// The body site-layout-* class owns visibility. Always render the post
// sidebar so User-Agent or request-specific context cannot remove widgets
// from an otherwise two-column article page.
?>
<div class="sidebar aksrt-article-sidebar" role="complementary" aria-label="<?php esc_attr_e('侧栏', 'aksrt'); ?>">
<?php
dynamic_sidebar('all_sidebar_top');
dynamic_sidebar('single_sidebar');
dynamic_sidebar('all_sidebar_bottom');
?>
</div>
<?php
}
endif;