<?php
/**
 * The template for displaying all default single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package WordPress
 * @subpackage ExS
 * @since 0.0.1
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
ob_start();
exs_entry_meta( true, true, true, true, true );
$entry_meta_html = ob_get_clean();
$meta_class = exs_option( 'blog_single_meta_sidebar', false ) ? ' d-none visible-md' : '';

get_template_part( 'template-parts/sidebar-top-bottom', null, array( 'sidebar-name' => 'sidebar-post-top' ) );
?>
	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> itemtype="https://schema.org/Article" itemscope="itemscope">
		<?php
		$exs_show_title = ! exs_option( 'title_show_title', '' ) && get_the_title();
		if ( $exs_show_title ) :
			?>
		<header class="entry-header">
			<?php the_title( '<h1 class="entry-title" itemprop="headline"><span>', '</span></h1>' ); ?>
		</header>
			<?php
		else :
			echo '<h4 class="hidden" itemscope="itemscope" itemprop="headline" itemtype="https://schema.org/Text">' . esc_html( get_the_title() ) . '</h4>';
		endif; //show_title

		exs_post_thumbnail();

		?>
		<div class="item-content d-flex">
			<?php if ( $entry_meta_html ) : ?>
			<div class="entry-footer-side">
				<footer
					class="entry-footer entry-footer-side entry-footer-sticky <?php echo esc_attr( $meta_class ); ?>"><?php exs_entry_meta( true, true, true, true, true ); ?></footer>
				<div></div>
				<!-- .entry-footer -->
			</div>
			<?php else: ?>
			<footer class="entry-footer entry-footer-side"></footer>
			<?php endif; ?>
			<div class="entry-content" itemprop="text">
				<?php

				the_content();

				wp_link_pages(
					exs_get_wp_link_pages_atts()
				);
				?>
			</div><!-- .entry-content -->
		</div><!-- .item-content -->
	</article><!-- #post-<?php the_ID(); ?> -->
<?php
get_template_part( 'template-parts/sidebar-top-bottom', null, array( 'sidebar-name' => 'sidebar-post-bottom' ) );

exs_related_posts( get_the_ID() );

get_template_part( 'template-parts/post/bio' );

exs_post_nav();

// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
	comments_template();
}
