<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @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 title="<?php echo esc_attr( single_cat_title( '', false ) ); ?>">
        <?php
        $category = get_the_category();
        if ( ! empty( $category ) ) {
            echo esc_html( $category[0]->name );
        }
        ?>
    </h5>
				<h1><?php single_post_title(); ?></h1> 
				<p><a href="<?php echo esc_url( get_permalink( get_option( 'page_for_posts' ) ) ); ?>"> <?php echo esc_html( get_bloginfo( 'name' ) ); ?> Blog</a> / <?php single_post_title(); ?></p>
            </div>
        </div>
    </div>
</header>

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

		<?php
		while ( have_posts() ) :
			the_post();

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

			the_post_navigation(
				array(
					'prev_text' => '<span class="nav-subtitle">' . esc_html__( 'Previous:', 'ello-lite-photography' ) . '</span> <span class="nav-title">%title</span>',
					'next_text' => '<span class="nav-subtitle">' . esc_html__( 'Next:', 'ello-lite-photography' ) . '</span> <span class="nav-title">%title</span>',
				)
			);

			// 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;

		endwhile; // End of the loop.
		?>

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

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

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

	<?php get_footer();
