<?php

/**
 * Theme blog layouts
 * @package Glaciers
 * @since 1.0.0
 */

if (!defined('ABSPATH')) {
	exit; // Exit if accessed directly.
}


/* BLOG LAYOUT
   ====================================================*/
if (!function_exists('glaciers_blog_layout')) :
	function glaciers_blog_layout()
	{

		$glaciers_blog_style = apply_filters('glaciers_blog_layout', get_theme_mod('glaciers_blog_style', 'classic-right'));

		// Start
		if (have_posts()) :

			switch (esc_attr($glaciers_blog_style)) {

				case "gallery":
					echo '<div class="container"><div id="grid-wrapper" class="posts-grid masonry-grid">';
					while (have_posts()) : the_post();
						// Get the post summary
						get_template_part('template-parts/content-gallery.php');
					endwhile;
					echo '</div></div>';
					// Blog navigation
					glaciers_blog_nav();
					break;

				case "classic-left":
					echo '<div class="container"><div class="row"><div class="col-lg-8 order-1 order-2">';
					/* Start the Loop */
					while (have_posts()) :
						the_post();
						get_template_part('template-parts/content');
					endwhile;
					glaciers_blog_nav();
					echo '</div><aside class="widget-area left-sidebar order-1 col-lg-4">';
					get_sidebar();
					echo '</aside>';
					break;

				default:
					echo '<div class="container"><div class="row"><div class="col-lg-8">';
					/* Start the Loop */
					while (have_posts()) :
						the_post();
						get_template_part('template-parts/content');
					endwhile;
					glaciers_blog_nav();
					echo '</div><aside class="widget-area blog-sidebar col-lg-4">		';
					get_sidebar();
					echo '</aside>';
			}

		else :
			get_template_part('template-parts/content', 'none');
		endif;
		// End		

	}
endif;
