<?php
/**
 * The template for displaying all single posts
 *
 * @package ClubTravel
 */

get_header(); ?>

<section id="content" class="content content-single position-relative py-5">
	<div class="container">
		<div class="row">
		<?php if ( is_active_sidebar( 'primary_sidebar' ) ) : ?>
			<div class="col-12 col-sm-8">
		<?php else : ?>
			<div class="col-12">
		<?php endif; ?>
			<?php if ( have_posts() ) : ?>
				<?php while ( have_posts() ) : ?>
					<?php the_post(); ?>
					<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
						<?php if ( has_post_thumbnail() ) : ?>
						<div class="post-item">
						<?php else : ?>
						<div class="post-item post-item-no-image">
						<?php endif; ?>
							<div class="row">
							<?php if ( has_post_thumbnail() ) : ?>
								<div class="col-12">
									<div class="post-image">
										<?php the_post_thumbnail( 'medium_large' ); ?>
									</div>
								</div>
							<?php endif; ?>
								<div class="col-12">
									<div class="post-info">
										<div class="post-categories-list">
											<?php echo wp_kses_post( get_the_category_list() ); ?>
										</div>
										<div class="post-title">
											<h1><?php the_title(); ?></h1>
										</div>
										<?php get_template_part( 'inc/post', 'meta' ); ?>
										<div class="post-message">
											<?php the_content(); ?>
											<?php
											wp_link_pages(
												array(
													'before' => '<div class="page-link">' . __( 'Pages:', 'clubtravel' ),
													'after'  => '</div>',
												)
											);
											?>
										</div>
										<div class="post-edit clearfix">
											<?php edit_post_link( __( 'Edit', 'clubtravel' ), '<span class="edit-link">', '</span>' ); ?>
										</div>
										<div class="post-tags">
											<?php the_tags( '<p class="tags">', ' ', '</p>' ); ?>
										</div>
										<?php if ( comments_open() || '0' !== get_comments_number() ) : ?>
											<?php comments_template( '', true ); ?>
										<?php endif; ?>
										<div class="post-navigation">
											<div class="row">
												<div class="col-12 col-sm-6">
													<?php previous_post_link(); ?>
												</div>
												<div class="col-12 col-sm-6 text-right">
													<?php next_post_link(); ?>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				<?php endwhile; ?>
			<?php endif; ?>
			</div>
		<?php if ( is_active_sidebar( 'primary_sidebar' ) ) : ?>
			<div class="col-12 col-sm-4">
				<?php get_sidebar(); ?>
			</div>
		<?php endif; ?>
		</div>
	</div>
</section>

<?php get_footer(); ?>
