<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package Blog Bee
 */
use BBE\Helpers as Helpers;
use BBE\Customizer\Theme_Defaults as Theme_Defaults;
use BBE\Customizer\Section\Breadcrumb as Breadcrumb;
use BBE\Customizer\Section\Single as Single;
use BBE\Customizer\Section\Related_Posts as Related_Posts;

get_header();

	Helpers::check_single_layout_post_meta();
	$block_class[] = 'blog-bee-main-wrap';
	$block_class[] = 'card--' . Theme_Defaults::get_theme_option( 'single_container' );
	$block_class[] = 'ratio--' . Theme_Defaults::get_theme_option( 'single_image_ratio' );
	$block_class[] = 'layout--' . Single::get_instance()->get_layout();
	$content_alignment = Theme_Defaults::get_theme_option( 'single_element_alignment' );
	$block_class[] = 'align--' . $content_alignment;

	?>
		<div class="bbe-sections-wrap">

			<div class="<?php echo esc_attr( implode( ' ', $block_class ) ); ?>">
	
				<div class="bbe-container">
	
					<div class="row">
	
						<?php
	
							Breadcrumb::get_instance()->render_html();
	
							if( Single::get_instance()->get_layout() !== 'one' ) Single::get_instance()->get_single_header();
	
							ob_start();
								$main_class[] = 'site-main';
								?>
	
									<main id="primary" class="<?php echo esc_attr( implode( ' ', $main_class ) ); ?>" <?php Helpers::the_aos_data_attr(); ?>>
	
										<?php
											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;
	
											endwhile; // End of the loop.
										?>
	
									</main><!-- #main -->
	
								<?php
								
							$content = ob_get_clean();
	
							$content_args = [
								'content'	=>	$content
							];
	
							get_template_part( 'template-parts/content', 'sidebar-reorder', $content_args );
	
							Related_Posts::get_instance()->render_html();
						?>
	
					</div>
	
				</div>
				
			</div><!-- .blog-bee-main-wrap -->

		</div><!-- .bbe-sections-wrap -->

	<?php

get_footer();
