<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package Edumodo
 */
	$post_id = edumodo_get_id();

	// sidebar position
	$sidebar_details   		= edumodo_get_theme_mod('edumodo_single_blog_post_layout', 'right-sidebar');
	$enable_related_post   	= edumodo_get_theme_mod('edumodo_single_blog_related_post_taxonomy', 'on');

	// view counter
setPostViews(get_the_ID());

// Page title enable


get_header(); ?>

<div id="primary" class="content-area">
	<main id="main" class="site-main">
		<div class="content-wrap">
			<div class="container">
				<div class="row">
					<?php if ('left-sidebar' == $sidebar_details): ?>
						<div class="col-md-4">
							<?php get_sidebar(); ?>
						</div> 
					<?php endif; ?>

					<?php if ('no-sidebar' == $sidebar_details): ?>
						<div class="col-md-12">
							<?php else: ?>
								<div class="col-md-8 content-wrapper">
								<?php endif; ?>

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

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

									the_post_navigation( );
									
							endwhile; // End of the loop.

							?>
							<?php
							$related = new WP_Query( ( 
								array( 
									'category__in' => wp_get_post_categories($post->ID), 
									'post__not_in' => array($post->ID) ,
									'orderby' => 'post_date',
									'order' => 'DESC',
									'posts_per_page' => 2,

								) 
							)
						);
						?>	

						<?php 
								// 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;
					?>
				</div> 

				<?php if ('right-sidebar' == $sidebar_details): ?>
					<div class="col-md-4">
						<?php get_sidebar(); ?>
					</div>

					<?php elseif('no-sidebar' == $sidebar_details): ?>
						
						<?php else: ?>
							<div class="col-md-4 sidebar-wrapper-2">
								<?php get_sidebar(); ?>
							</div> 
						<?php endif; ?>

					</div><!-- .row -->
				</div><!-- .container -->
			</div>
		</main><!-- #main -->
	</div><!-- #primary -->

	<?php
		get_footer();
