<?php get_header() ?>
	
	<?php
			
		// ottengo il numero di pagina
		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
			
	?>
	<?php if($paged==1 and $iw_opt['slider_enable']) : ?>
		<?php get_template_part('part', 'slider'); ?>
	<?php endif; ?>
	
	<?php if($paged==1 and $iw_opt['chess_enable']) : ?>

		<?php 
		
		if( $iw_opt['chess-ver'] == 1){
			get_template_part('part', 'chess');
		} elseif( $iw_opt['chess-ver'] == 2){
			get_template_part('part', 'chess2');
		} elseif( $iw_opt['chess-ver'] == 3){
			get_template_part('part', 'chess3');
		} else{
			get_template_part('part', 'chess');
		}
		?>
	<?php endif; ?>

	<section id="featured" class="container">
		<div class="wrapper">
			<div class="row">
				<div class="col-lg-12 col-sm-12">
					<?php if($paged==1 and $iw_opt['showfeatured']) : ?>
						<div class="wrapper featured-articles">
						
							<h2><span><?php echo($iw_opt['titlefeatured']) ?></span></h2>
							
							<div class="row">
							
							<?php get_template_part('part', 'featured') ?>
							
							</div>
							
						</div>
					<?php endif; ?>
				</div>
			</div>
		</div>
	</section>
	
	<section id="content" class="container">
		<div class="wrapper">
		
			<div class="row">
				<div id="main" class="col-lg-8 col-sm-8">
					
					<div id="articlelist">
						<?php
						
							/*
						
							standard article list
						
							*/
							
							if ( isset($iw_opt['catchess']) and $iw_opt['catchess'] != '' and $iw_opt['chess_enable'] == '1'){
								$remove_catchess = $iw_opt['catchess'];
							}

							if ( isset($iw_opt['slider_cat']) and $iw_opt['slider_cat'] != '' and $iw_opt['slider_enable'] == '1'){
								$remove_catslider = $iw_opt['slider_cat'];
							}

							if ( isset($iw_opt['catfeatured']) and $iw_opt['catfeatured'] != ''){
								$remove_catfeatured = $iw_opt['catfeatured'];
							}

							if ( empty($remove_catchess) ) $remove_catchess = '1';
							if ( empty($remove_catslider) ) $remove_catslider = '1';
							if ( empty($remove_catfeatured) ) $remove_catfeatured = '1';
							
							$args = array(
								'paged' => $paged,
								//'ignore_sticky_posts' => 1,
								'posts_per_page' => get_option('posts_per_page'),
								'cat'	=> 10//-$remove_catchess.','.-$remove_catfeatured.','.-$remove_catslider,
							);
									
							$query = new WP_Query( $args );
						
						if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
						
								get_template_part('loop', 'archive');
							
							endwhile;
						
						?>
						
						<?php if(function_exists('wp_pagenavi')) : ?>
							<div class="iw-navigation">
								<?php wp_pagenavi( array( 'query' => $query )); ?>
				            </div>
						<?php else : ?>

						<div class="row">
							<div class="col-xs-6">
								<?php next_posts_link( '<span class="fa-stack fa-lg">
								  <i class="fa fa-circle fa-stack-2x"></i>
								  <i class="fa fa-long-arrow-left fa-stack-1x fa-inverse"></i>
								</span>' ); ?>
							</div>
							<div class="col-xs-6 text-right">
								<?php previous_posts_link( '<span class="fa-stack fa-lg">
								  <i class="fa fa-circle fa-stack-2x"></i>
								  <i class="fa fa-long-arrow-right fa-stack-1x fa-inverse"></i>
								</span>' ); ?>
							</div>
						</div>

						<?php endif; ?>

						<?php else:  ?>
						  <p><?php _e( 'Last articles: You have to make other articles to show here', 'roma' ); ?></p>
						<?php endif; ?>

						<?php
								
							wp_reset_postdata();
								
						?>
					
					</div>
					
				</div> <!-- ./main -->
			
				<aside class="col-lg-4 col-sm-4">
					<div class="asidefix">
						<?php get_sidebar() ?>
					</div>
				</aside>	
			</div> <!-- /row featured -->
			
		</div>
	</section>
	
<?php get_footer() ?>