<?php
get_header();

$opt = lifeline()->options();

$meta = lifeline()->page()->args;
$single_meta = lifeline()->meta( get_the_ID() );

$layout  = lifeline_get( $meta, 'sidebar_position', 'left' );
$style  = lifeline_get( $opt, 'post_detail_style');
$sidebar = lifeline_get( $meta, 'sidebar', 'sidebar-1' );
$col     = ( $layout != 'full' ) ? '9' : '12'; // phpcs:ignore WordPress
$col     = apply_filters( 'lifeline/post/life_signle/content/classes', "col-md-12 col-sm-12 col-lg-{$col}" );
$post_set = lifeline_get( $single_meta , 'single_post_meta' );

?>

<section class="py-110">
	<div id="post-<?php the_ID(); ?>" <?php post_class( 'py-80 bg-gray position-relative w-100' ); ?>>
			<?php 
				if ( $post_set ) {
				    exit('in outer if');
					if ( lifeline_get( $single_meta, 'singple_post_source_type' ) == 'default' ) {
						?>
							<div class="container">
								<div class="row">
									<?php
										if ( $layout == 'left' ) { // phpcs:ignore WordPress
											// phpcs:ignore WordPress
											do_action( 'lifeline/post/sidebar', $sidebar );
										}
									?>
				                    	<?php
										while ( have_posts() ) {
											the_post();
											$format = get_post_format();
											?>
									<div class="<?php echo esc_attr( $col ); ?>">

				                    <?php lifeline_template_load( 'templates/blog-details/'.$style.'.php' ); ?>
										
									</div>
				                    <?php
											
										} ?>
									<?php
										if ( $layout == 'right' ) { // phpcs:ignore WordPress
											// phpcs:ignore WordPress
											do_action( 'lifeline/post/sidebar', $sidebar );
										}
									?>
								</div>
							</div>				
						<?
					} else {
						lifeline_el_tpl( lifeline_get( $single_meta, 'single_post_elementor_template' ) ); ?>
						<div class="lif_content"> 
						   <?php the_content(); ?>
						</div>
						<?php
					}
				} else {
					if ( lifeline_get( $opt, 'singple_post_src_type' ) == 'default' ) {
						?>
							<div class="container">
								<div class="row">
									<?php
										if ( $layout == 'left' ) { // phpcs:ignore WordPress
											// phpcs:ignore WordPress
											do_action( 'lifeline/post/sidebar', $sidebar );
										}
									?>
				                    	<?php
										while ( have_posts() ) {
											the_post();
											$format = get_post_format();
											?>
									<div class="<?php echo esc_attr( $col ); ?>">

				                    <?php lifeline_template_load( 'templates/blog-details/'.$style.'.php' ); ?>
										
									</div>
				                    <?php
											
										} ?>
									<?php
										if ( $layout == 'right' ) { // phpcs:ignore WordPress
											// phpcs:ignore WordPress
											do_action( 'lifeline/post/sidebar', $sidebar );
										}
									?>
								</div>
							</div>
						<?php
					} else {
						lifeline_el_tpl( lifeline_get( $opt, 'sngl_post_elementor_template' ) ); ?>
						<div class="lif_content">
						    <?php the_content(); ?>
						</div> <?php
					}
				}
			?>
	</div>
</section>

<?php
get_footer();