<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package Canyon Themes
 * @subpackage Sewa
 */
get_header();
$sewa_designlayout      = get_post_meta(get_the_ID(), 'sewa_sidebar_layout', true  ); 
$sidebardesignlayout = esc_attr(sewa_get_option( 'sewa_sidebar_layout_option' ) );
?>

 <section id="inner-title" class="inner-title" >
        <div class="container">
            <div class="row">
                <div class="col-md-8"><h2><?php the_title(); ?></h2></div>
            </div>
        </div>
</section>
<?php 
	$sidebar_primary_classes_alignment =  '' ;
	if ( $sidebardesignlayout == 'left-sidebar') { 
		$sidebar_primary_classes_alignment =  ' order-md-2' ;

	}
?>
<section class="section-margine gray-bg">
    <div class="container">
        <div class="row">
            <div class="col-sm-12 col-md-<?php if ( $sewa_designlayout == 'no-sidebar' ) {
                echo "12";
            } else {
                echo "8";
            }  echo $sidebar_primary_classes_alignment; ?> left-block">
                <?php
                while (have_posts()) : the_post();
                    
                    get_template_part('template-parts/content', 'single');
                    
                        echo '<div class="entry-box">';
                        /**
                         * sewa_post_navigation_action hook
                         * @since Sewa 1.0.0
                         *
                         * @hooked sewa_post_navigation_action -  10
                         */
                        do_action( 'sewa_post_navigation_action' ,get_the_ID() );

                        echo '<div class="comment-form-container">';

                        /**
                         * sewa_related_posts hook
                         * @since Sewa 1.0.0
                         *
                         * @hooked sewa_related_posts -  10
                         */
                        do_action( 'sewa_related_post_action' ,get_the_ID() );
                        
                        // 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;

                        echo '</div>';
                    echo '</div>';
                endwhile; // End of the loop.
                ?>
            </div>
            <?php
             $sidebar_classes_alignment =  '' ;
			 if ( $sidebardesignlayout == 'left-sidebar') { 
			  $sidebar_classes_alignment =  'order-md-1' ;
			 
			 }
			
             if ( $sidebardesignlayout != 'no-sidebar') { ?>
             
                <div class="col-sm-12 col-md-4 <?php echo $sidebar_classes_alignment; ?>">
            
                    <?php get_sidebar(); ?>
             
                </div>
            
            <?php } ?>
        </div>
    </div>
</section>
<?php
get_footer(); ?>
