<?php
/**
 * The template for displaying search results pages.
 *
 * @package WordPress
 * @subpackage greenmart
 * @since greenmart 2.1.6
 */

get_header();
$sidebar_configs = greenmart_tbay_get_blog_layout_configs();

$active_theme = greenmart_tbay_get_part_theme();

greenmart_tbay_render_breadcrumbs();
?>
<section id="main-container" class="main-content  <?php echo apply_filters('greenmart_tbay_blog_content_class', 'container');?> inner">
	<div class="row">
		<?php if ( isset($sidebar_configs['left']) ) : ?>
			<div class="<?php echo esc_attr($sidebar_configs['left']['class']) ;?>">
			  	<aside class="sidebar sidebar-left" itemscope="itemscope" itemtype="http://schema.org/WPSideBar">
			   		<?php dynamic_sidebar( $sidebar_configs['left']['sidebar'] ); ?>
			  	</aside>
			</div>
		<?php endif; ?>

		<div id="main-content" class="col-sm-12 <?php echo esc_attr($sidebar_configs['main']['class']); ?>">
			<main id="main" class="site-main layout-blog" role="main">

			<?php if ( have_posts() ) : ?>

				<header class="page-header hidden">
					<?php
						the_archive_description( '<div class="taxonomy-description">', '</div>' );
					?>
				</header><!-- .page-header -->

				<?php
				// Start the Loop.
				while ( have_posts() ) : the_post();

					/*
					 * Include the Post-Format-specific template for the content.
					 * If you want to override this in a child theme, then include a file
					 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
					 */
					?>
							<?php get_template_part( 'post-formats/'.$active_theme.'/content', get_post_format() ); ?>
					<?php
				// End the loop.
				endwhile;

				// Previous/next page navigation.
				greenmart_tbay_paging_nav();

			// If no content, include the "No posts found" template.
			else :
				get_template_part( 'post-formats/'.$active_theme.'/content', 'none' );

			endif;
			?>

			</main><!-- .site-main -->
		</div><!-- .content-area -->
		<?php if ( isset($sidebar_configs['right']) ) : ?>
			<div class="<?php echo esc_attr($sidebar_configs['right']['class']) ;?>">
			  	<aside class="sidebar sidebar-right" itemscope="itemscope" itemtype="http://schema.org/WPSideBar">
			   		<?php dynamic_sidebar( $sidebar_configs['right']['sidebar'] ); ?>
			  	</aside>
			</div>
		<?php endif; ?>
		
	</div>
</section>
<?php get_footer(); ?>
