<?php
/**
 * @version	$Id$
 * @package	IT_Theme_Framework
 * @author	 InnoThemes Team <support@innothemes.com>
 * @copyright  Copyright (C) 2012 InnoThemes.com. All Rights Reserved.
 * @license	GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 * Websites: http://www.innothemes.com
 * Template Name: Homepage
 */

// Get theme options
global $it_options;

get_header(); 
?>
	<div id="it-body">
		<div id="it-content-top">
			<?php IT_Theme_Render::promo(); ?>
			<div id="it-under-promo">
				<?php get_template_part( 'loop', 'member' ); ?>
			</div><!--End div#it-under-promo-->
		</div><!--End div#it-content-top-->
		<div id="it-content">	
			<?php get_template_part( 'loop', 'portfolio' ); ?>
			<div id="it-home-post">
				<div class="row">
					<div class="col-md-9">
						<?php 
						$args = array( 'posts_per_page' => 1 );
						$featuredpost = get_posts( $args );
						foreach ( $featuredpost as $post ) : setup_postdata( $post ); 
						global $more;
						$more = 0;
						?>
							<article class="it-featured-post">
								<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
								<?php the_content(''); ?>
							</article><!--End div.it-featured-post-->
						<?php endforeach; wp_reset_postdata(); ?>
						<?php 
						$homepost = new WP_Query( 'showposts=6&offset=1' );
						if( $homepost->have_posts() ) :
							$i = 0; 
							while ($homepost->have_posts()) : 
								$homepost->the_post();
							echo ( $i % 2 == 0 ) ? "<div class='row-fluid'>" : "";
						?>
							<article class="it-home-entry col-md-6">
								<?php if ( has_post_thumbnail() ) { 
							        the_post_thumbnail( 'homethumb' );
							    }
							    ?>
								<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
								<?php the_excerpt(); ?>
							</article><!--End div#it-homepost-->
						<?php 
						echo ( ( $i+1 ) % 2 == 0 || $homepost->post_count==$i+1  )? "</div>" : "";
						$i++;
						endwhile; endif; wp_reset_query();
						?>
					</div><!--End div.col-md-9-->
					<div class="col-md-3">
						<?php dynamic_sidebar( 'right-home' ); ?>
					</div><!--End div.col-md-3-->
				</div><!--End div.row-->
			</div><!--End div#it-home-post-->
			<div id="it-customer">
				<?php get_template_part( 'loop', 'customer' ); ?>
			</div><!--End div#it-customer-->
		</div><!--End div#it-content-->
		<div id="it-content-bottom">
			<?php get_sidebar( 'bottom' ); ?>
		</div><!--End div#it-content-bottom-->
	</div><!-- End#it-body-->
<?php get_footer(); ?>