<?php
/**
 * The template for displaying the full width grid section.
 *
 * @package WordPress
 * @subpackage Edition
 * @since Edition 1.0
 */
global
$tw_order_class, 	// section order
$tw_section, 		// section object
$paged_section,		// section pagination
$grid_size; 		// grid size

$tw_section 	= themewich_section_object(); 	// section post options
$section_post 	= $post; 						// Store Section Post
$grid_size 		= 'fullgrid'; 					// Set first grid class

// Set post classes
$tw_section->post_classes  = array(
	'no-top-margin',
	'grid',
	'grid-full',
	'section',
	$tw_order_class,
	$tw_section->title_class
); ?>

<div <?php post_class($tw_section->post_classes); ?>>
	<?php themewich_section_edit(); // edit button ?>

	<div class="container">
		<div class="imagegrid full col-md-12">
			<?php get_template_part( TW_SECTIONS_DIR .'/section-title'); 	// Section title  ?>
			<div class="loading"></div>
			<div class="grid-wrapper" id="section-<?php the_ID(); ?>">
				<div class="homeposts grid-full">
					<div class="isotopecontainer" data-value="3">
						<?php
							// for pagination
							global $wp_query;
							$paged_section = isset( $_GET['paged_section'] ) ? (int) $_GET['paged_section'] : 1;

							// Additional query arguments
							$args = array(
								'ignore_sticky_posts'   => 1,   					// Ignore Sticky Posts
								'post_type'             => array( 'post' ), 		// Get posts
								'paged'                 => $paged_section,  				// Add pagination
							);

							// Filter the latest posts by type chosen
							$args = themewich_post_args($args);

							wp_reset_query(); 					// Reset query
							$wp_query = new WP_Query($args); 	// Query the posts

							// Start the loop
							while ($wp_query->have_posts()) : $wp_query->the_post();
						?>

						<div class="isobrick">
							<?php get_template_part(TW_TEMPLATES_DIR . '/template-grid'); ?>
						</div>

						<?php
							$grid_size = 'halfgrid';  // Sest remaining grid size
							endwhile; 			// End Loop
						?>
						<div class="clear"></div>
		            </div>

		            <?php
						if ($tw_section->section_pagination != 'off') :
							themewich_pagination();
						endif; // end if pagination
					?>

					<?php wp_reset_query(); // Reset Query ?>

				</div><!--.homeposts-->
			</div><!--.gridwrapper-->
		</div><!--.imagegrid-->
		<div class="clear"></div>

	</div><!--.container-->
</div><!--.homesection-->