<?php

/**
 * Theme full post layouts
 * @package Glaciers
 * @since 1.0.0
 */

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

/* POST LAYOUT
   ====================================================*/
if (!function_exists('glaciers_post_layout')) :
	function glaciers_post_layout()
	{

		// Are the options activated in the customizer.		
		$glaciers_post_style = apply_filters('glaciers_post_style', get_theme_mod('glaciers_post_style', 'classic-right'));
		$glaciers_hide_post_navigation = get_theme_mod('glaciers_hide_post_navigation', false);

		// Start
		if (have_posts()) :

			switch (esc_attr($glaciers_post_style)) {

				case "center":
					echo '<div class="container"><div class="row">';
					/* Start the Loop */
					while (have_posts()) :
						the_post();
						get_template_part('template-parts/content', 'single');
						// If comments are open or we have at least one comment, load up the comment template.
						if (comments_open() || get_comments_number()) :
							comments_template();
						endif;

						// Action hook for any content placed after post comments
						do_action('glaciers_after_post_comments');
					endwhile;
					// Post navigation  
					if (false === $glaciers_hide_post_navigation) {
						glaciers_post_pagination();
					}
					echo '</div></div>';
					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', 'single');
						// If comments are open or we have at least one comment, load up the comment template.
						if (comments_open() || get_comments_number()) :
							comments_template();
						endif;
						// Action hook for any content placed after post comments
						do_action('glaciers_after_post_comments');
					endwhile;
					// Post navigation  
					if (false === $glaciers_hide_post_navigation) {
						glaciers_post_pagination();
					}
					echo '</div>';
					get_sidebar();
					echo '</div>';
					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', 'single');
						// If comments are open or we have at least one comment, load up the comment template.
						if (comments_open() || get_comments_number()) :
							comments_template();
						endif;
						// Action hook for any content placed after post comments
						do_action('glaciers_after_post_comments');
					endwhile;
					// Post navigation  
					if (false === $glaciers_hide_post_navigation) {
						glaciers_post_pagination();
					}
					echo '</div><aside class="widget-area blog-sidebar col-lg-4">		';
					get_sidebar();
					echo '</div>';
			}

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

	}
endif;
