<?php
/**
 * @package norstar
 */
global $themesflat_thumbnail;
$themesflat_thumbnail = 'themesflat-blog';
?>

<article id="post-<?php the_ID(); ?>" <?php post_class( 'blog-post blog-single' ); ?>>
	<!-- begin feature-post single  -->
	<?php if ( themesflat_get_opt( 'post_single_breadcrumb_enabled' ) == 1 ) : ?>
		<?php themesflat_breadcrumb(); ?>
	<?php endif; ?>
	
	<?php 

		$content_single_elements = themesflat_layout_draganddrop(themesflat_get_opt( 'post_single_content_elements' )); 
		$post_single_elements = themesflat_layout_draganddrop(themesflat_get_opt( 'meta_elements_single' ));
		foreach ( $content_single_elements as $content_single_element ) :
					if( 'tag' == $content_single_element ){
						get_template_part( 'tpl/entry-content/entry-content-tag' );
					} elseif ( 'title' == $content_single_element ) {
						get_template_part( 'tpl/entry-content/entry-content-title' );
					} elseif ( 'meta' == $content_single_element ) { ?>
						<div class="wrap-meta">
							
							<div class="content-post-single">
								<div class="meta">
										<?php 
											$meta_elements = themesflat_layout_draganddrop(themesflat_get_opt( 'meta_elements_single' ));

											$left_column_elements = array_slice($meta_elements, 0, 2);
											$right_column_elements = array_slice($meta_elements, 2, 4); 
										?>
										<div class="left flex align-items-center">
											<?php 
												foreach ( $left_column_elements as $meta_element ) :
													render_meta_post_single($meta_element);
												endforeach;
											?>
										</div>								

										<div class="right flex align-items-center">
											<?php 
												foreach ( $right_column_elements as $meta_element ) :
													render_meta_post_single($meta_element);
												endforeach;
											?>
										</div>										
								</div>
							</div>
						</div>
					<?php } elseif ( 'excerpt_content' ) { ?>
						<p class="single-post-descrition"> <?php echo wp_trim_words(get_the_excerpt(), 10); ?> </p>
					<?php } ?>
	<?php endforeach; ?>
	
	<?php 
		$post_author_id = get_post_field('post_author', get_the_ID());

				

		
		
	?>
	<?php if ( themesflat_get_opt('show_feature_post_single') == 1 ): ?>
		<?php get_template_part( 'tpl/feature-post-single'); ?>
	<?php endif; ?>

	
	<!-- end feature-post single-->
	
	
	<div class="main-post">		
		<div class="entry-content clearfix">
			<?php the_content(); ?>

			
			<?php
				wp_link_pages( array(
					'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'norstar' ),
					'after'  => '</div>',
					'link_before' => '<span>',
					'link_after'  => '</span>'
				) );
			?>
		</div><!-- .entry-content -->
	</div><!-- /.main-post -->
	<?php if( themesflat_get_opt('show_entry_footer_content') == 1 ): ?>		
		<?php themesflat_entry_footer(); ?>
	<?php endif; ?>
</article><!-- #post-## -->

