<?php
/**
 * The main template file.
 *	
 * @package vt-grid-mag
 */
	get_header();
	$layout = vt_grid_mag_external_current_layout();
?>

<div id="primary" class="content-area clearfix" role="main">
<?php
	if( have_posts() ) {
					
		// Post Wrap.
		if( 'layout-default' != $layout ) {
			echo '<div class="post-container">';
		}

		// Start the Loop.
		while( have_posts() ) {
			the_post();
						
			// Include template for the content.
			if( 'layout-default' != $layout ) {
				get_template_part( 'content', 'grid' );
			}
			else {
				get_template_part( 'content', get_post_format() );
			}
		}

		// End Post Wrap.
		if( 'layout-default' != $layout ) {
			echo '</div>';
		}
		
		// Pagination.
		the_posts_pagination();

	}
	else {
		// Not Found Template.
		get_template_part( 'content', 'none' );
	}
?>

</div>
<!-- #primary -->

<?php
	if( 'layout-default' == $layout || 'layout-two-columns' == $layout ) {
		get_sidebar();
	}
	get_footer();