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

get_header();
?>

	<div id="primary" class="content-area">
		<main id="main" class="site-main ">
			<div class ="row " >
				<?php get_template_part( 'inc/layout/layout-1' ); ?>
				<?php $nextPost = get_previous_post();
				if(!empty($nextPost) && ($nextPost->ID != get_the_ID())): ?>
					<div class="left-float-post">
						<div class="media">
							<img class="mr-3" src="<?php echo esc_url(get_the_post_thumbnail_url($nextPost->ID,'queens-magazine-blog-155-125'));?>">
							<div class="media-body">
							<span class="post-close" id="left-float-post"><i class="fa fa-times"></i></span>
							<span class="post-arrow "  ><i class="fa fa-backward"></i></span>
							<h3 class="mt-0 mb-1"><a href="<?php echo esc_url(get_permalink($nextPost->ID));?>"><?php echo esc_html(get_post($nextPost->ID)->post_title);?></a></h3>
							<p><?php echo esc_html(get_the_date('',$nextPost->ID));?></p>
							</div>
						</div>
					</div>
				<?php 
				endif;
				$prevPost = get_next_post();
				if(!empty($prevPost) && ($prevPost->ID != get_the_ID())):
				?>
				<div class="right-float-post">
					<div class="media">
						<img class="mr-3" src="<?php echo esc_url(get_the_post_thumbnail_url($prevPost->ID,'queens-magazine-blog-155-125'));?>">
						<div class="media-body">
							<span class="post-close" id="right-float-post"><i class="fa fa-times"></i></span>
							<span class="post-arrow "><i class="fa fa-forward"></i></span>
							<h3 class="mt-0 mb-1"><a href="<?php echo esc_url(get_permalink($prevPost->ID));?>"><?php echo esc_html(get_post($prevPost->ID)->post_title);?></a></h3>
						<p><?php echo esc_html(get_the_date('',$prevPost->ID));?></p> 		
						</div>
					</div>
				</div>
				<?php 
				endif; ?>
			</div>
    	</main><!--- #main -->
	</div>
<?php get_footer();