<?php
/**
 * Sidebar template - basic sidebar
 *
 * @package Multi
 */

if ( ! defined( 'ABSPATH' ) ) {
	die;
}

if ( is_singular() ) {
	$multimagazine_sidebar = get_post_meta( $post->ID, 'multi_custom_sidebar', true );
	if ( empty( $multimagazine_sidebar ) || 'default' === $multimagazine_sidebar ) {
		$multimagazine_sidebar = 'sidebar-widget-area';
	}
} else {
	$multimagazine_sidebar = 'sidebar-widget-area';
}

$heading_style   = 'heading-style-' . multimagazine_heading_style();
$sidebar_classes = array( 'sidebar', $heading_style );
?>
<aside class="<?php echo esc_attr( implode( ' ', $sidebar_classes ) ); ?>">
<?php
if ( ! function_exists( 'dynamic_sidebar' ) || ! dynamic_sidebar( $multimagazine_sidebar ) ) {
	dynamic_sidebar( $multimagazine_sidebar );
}
?>
</aside>
