<?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://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package ello-lite-photography
 */

get_header();
?>

<?php $header_image_url = get_header_image(); // Retrieve the default header image

// If the header image is not set, use a fallback
if (!$header_image_url) {
	$header_image_url = get_template_directory_uri() . '/img/default-bg.jpg';
	// Default image URL
} ?>

<header class="banner-header banner-img valign bg-img" data-overlay-light="5" data-background="<?php echo esc_url($header_image_url); ?>">
    <div class="container">
        <div class="row">
            <div class="col-md-7 offset-md-5 text-right caption mt-60">
			  <h5><?php echo esc_html( get_theme_mod( 'ello_blog_heading_subtitle', esc_html__('Current Reading', 'ello-lite-photography') ) ); ?></h5>
			  <h1><?php echo esc_html( get_theme_mod( 'ello_blog_heading_title', esc_html__('News & Blog', 'ello-lite-photography') ) ); ?></h1>
            </div>
        </div>
    </div>
</header>

		<!-- Blog  -->
		<section id="primary" class="section-padding">
    <div class="container">
        <div class="row">
            <div class="col-md-8">

		<?php
		if ( have_posts() ) :

			if ( is_home() && ! is_front_page() ) :
				?>
				<header>
					<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
				</header>
				<?php
			endif;

			/* Start the Loop */
			while ( have_posts() ) :
				the_post();

				/*
				 * Include the Post-Type-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 Type name) and that will be used instead.
				 */
				get_template_part( 'template-parts/content', get_post_type() );

			endwhile;

			the_posts_navigation();

		else :

			get_template_part( 'template-parts/content', 'none' );

		endif;
		?>

</div> <!-- #end col -->

<div class="col-lg-4"><?php get_sidebar(); ?></div>

        </div> <!-- #end row -->
    </div> <!-- #end container -->
	</section><!-- #end blog -->

	<?php get_footer();

