<?php
if(magnews_get_option( 'columns_num' ) != '2c'):
?>
<aside class="sidebar-narrow">
<?php
	if ( is_home() ){
	
		$sidebar_home = magnews_get_option( 'sidebar_narrow_home' );
		if( $sidebar_home )
			dynamic_sidebar ( sanitize_title( $sidebar_home ) ); 
			
		else dynamic_sidebar( 'narrow-primary-widget-area' );	
		
	}elseif( is_page() ){
		global $get_meta;
		$magnews_sidebar_pos = $get_meta["magnews_sidebar_pos"][0];

		if( $magnews_sidebar_pos != 'full' ){
			$magnews_sidebar_post = sanitize_title($get_meta["magnews_sidebar_narrow_post"][0]);
			$sidebar_page = magnews_get_option( 'sidebar_narrow_page' );
			if( $magnews_sidebar_post )
				dynamic_sidebar($magnews_sidebar_post);
				
			elseif( $sidebar_page )
				dynamic_sidebar ( sanitize_title( $sidebar_page ) ); 
			
			else dynamic_sidebar( 'narrow-primary-widget-area' );
		}

	}elseif ( is_single() ){
		global $get_meta;
		$magnews_sidebar_pos = $get_meta["magnews_sidebar_pos"][0];

		if( $magnews_sidebar_pos != 'full' ){
			$magnews_sidebar_post = sanitize_title($get_meta["magnews_sidebar_narrow_post"][0]);
			$sidebar_post = magnews_get_option( 'sidebar_narrow_post' );
			if( $magnews_sidebar_post )
				dynamic_sidebar($magnews_sidebar_post);
				
			elseif( $sidebar_post )
				dynamic_sidebar ( sanitize_title( $sidebar_post ) ); 
			
			else dynamic_sidebar( 'narrow-primary-widget-area' );
		}
		
	}elseif ( is_category() ){
		
		$category_id = get_query_var('cat') ;
		$cat_sidebar = magnews_get_option( 'sidebar_narrow_cat_'.$category_id ) ;
		$sidebar_archive = magnews_get_option( 'sidebar_narrow_archive' );

		if( $cat_sidebar )
			dynamic_sidebar ( sanitize_title( $cat_sidebar ) ); 
			
		elseif( $sidebar_archive )
			dynamic_sidebar ( sanitize_title( $sidebar_archive ) );
			
		else dynamic_sidebar( 'narrow-primary-widget-area' );
		
	}else{
		$sidebar_archive = magnews_get_option( 'sidebar_narrow_archive' );
		if( $sidebar_archive ){
			dynamic_sidebar ( sanitize_title( $sidebar_archive ) );
		}
		else dynamic_sidebar( 'narrow-primary-widget-area' );
	}
?>
</aside>
<?php endif; ?>
</div> <!-- .content-wrap -->
<aside class="sidebar">
<?php
	wp_reset_query();
	if ( is_home() ){
	
		$sidebar_home = magnews_get_option( 'sidebar_home' );
		if( $sidebar_home )
			dynamic_sidebar ( sanitize_title( $sidebar_home ) ); 
			
		else dynamic_sidebar( 'primary-widget-area' );	
		
	}elseif( is_page() ){
		global $get_meta;
		$magnews_sidebar_pos = $get_meta["magnews_sidebar_pos"][0];

		if( $magnews_sidebar_pos != 'full' ){
			$magnews_sidebar_post = sanitize_title($get_meta["magnews_sidebar_post"][0]);
			$sidebar_page = magnews_get_option( 'sidebar_page' );
			if( $magnews_sidebar_post )
				dynamic_sidebar($magnews_sidebar_post);
				
			elseif( $sidebar_page )
				dynamic_sidebar ( sanitize_title( $sidebar_page ) ); 
			
			else dynamic_sidebar( 'primary-widget-area' );
		}

	}elseif ( is_single() ){
		global $get_meta;
		$magnews_sidebar_pos = $get_meta["magnews_sidebar_pos"][0];

		if( $magnews_sidebar_pos != 'full' ){
			$magnews_sidebar_post = sanitize_title($get_meta["magnews_sidebar_post"][0]);
			$sidebar_post = magnews_get_option( 'sidebar_post' );
			if( $magnews_sidebar_post )
				dynamic_sidebar($magnews_sidebar_post);
				
			elseif( $sidebar_post )
				dynamic_sidebar ( sanitize_title( $sidebar_post ) ); 
			
			else dynamic_sidebar( 'primary-widget-area' );
		}
		
	}elseif ( is_category() ){
		
		$category_id = get_query_var('cat') ;
		$cat_sidebar = magnews_get_option( 'sidebar_cat_'.$category_id ) ;
		$sidebar_archive = magnews_get_option( 'sidebar_archive' );

		if( $cat_sidebar )
			dynamic_sidebar ( sanitize_title( $cat_sidebar ) ); 
			
		elseif( $sidebar_archive )
			dynamic_sidebar ( sanitize_title( $sidebar_archive ) );
			
		else dynamic_sidebar( 'primary-widget-area' );
		
	}else{
		$sidebar_archive = magnews_get_option( 'sidebar_archive' );
		if( $sidebar_archive ){
			dynamic_sidebar ( sanitize_title( $sidebar_archive ) );
		}
		else dynamic_sidebar( 'primary-widget-area' );
	}
?>
</aside>
<div class="clear"></div>