<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package bestel
 */

get_header(); ?>
	<?php get_template_part( 'wp-hotel-booking/search/search-form-page' ); ?>
	<?php if ( is_home() && ! is_front_page() ) : ?>
	<div class="section">
		<div class="blog_page">
			<div class="container">
				<div class="title-wrap text-center mb-0">
					<h1><?php echo esc_html__( 'Blog Posts', 'bestel' ); ?></h1>
					<div class="h-decor"></div>
				</div>
			</div>
		</div>
	</div>
	<?php endif; ?>
	<div class="section blog-page">
	  <div class="container">
		<div class="row">
			<?php
				$class = '';
			if ( is_active_sidebar( 'blog_sideber' ) ) :
				$class = '9';
				else :
					$class = '12';
				endif;
				?>
			<div class="col-lg-<?php echo esc_html( $class ); ?> aside">
				<?php
				if ( have_posts() ) :
					while ( have_posts() ) :
						the_post();
						get_template_part( 'template-parts/content', get_post_format() );
					endwhile;
					else :
						get_template_part( 'template-parts/content', 'none' );
					endif;
					?>
				<?php
					the_posts_pagination(
						array(
							'prev_text'          => esc_html__( '&laquo; Previous', 'bestel' ),
							'next_text'          => esc_html__( 'Next &raquo;', 'bestel' ),
							'mid_size'           => 10,
							'before_page_number' => '',
							'screen_reader_text' => ' ',
						)
					);
					?>
			</div>
			<div class="col-lg-3 aside mt-5 mt-lg-0">
				<?php get_sidebar(); ?>
			</div>    
		</div>
	  </div>
	</div>
<?php get_footer(); ?>
