<?php
$sidebar_position = get_theme_mod( 'extensive_news_frontpage_sidebar_position', 'frontpage-right-sidebar' );
$no_sidebar       = is_active_sidebar( 'secondary-widgets-section' ) ? '' : 'no-frontpage-sidebar';

if ( is_active_sidebar( 'primary-widgets-section' ) || is_active_sidebar( 'secondary-widgets-section' ) ) :
	$classes = implode( ' ', array( $sidebar_position, $no_sidebar ) )
	?>
<div class="main-widget-section">
	<div class="ascendoor-wrapper">
		<div class="main-widget-section-wrap <?php echo esc_attr( $classes ); ?>">
		<?php if ( is_active_sidebar( 'primary-widgets-section' ) ) { ?>
			<div class="primary-widgets-section ascendoor-widget-area">
				<?php dynamic_sidebar( 'primary-widgets-section' ); ?>
			</div>
			<?php } ?>
			<?php if ( is_active_sidebar( 'secondary-widgets-section' ) ) { ?>
			<div class="secondary-widgets-section ascendoor-widget-area">
				<?php dynamic_sidebar( 'secondary-widgets-section' ); ?>
			</div>
			<?php } ?>
		</div>
	</div>
</div>
<?php endif; ?>
