<?php
/**
 * The template for displaying all single posts.
 *
 * @package webhosty 
 */
global $post;
$header_title = $header_image= $position = '';
$position = get_post_meta($post->ID,'webhosty_post_sidebarposition',true);
$header_title = get_post_meta( $post->ID, 'webhosty_post_header_title',true );
$header_image = get_post_meta( $post->ID, 'webhosty_post_image_src',true );
if(!empty($header_image)){	   
  $image = $header_image;
}else{
  $image = get_template_directory_uri().'/images/1400x720-2.gif';
}
if(empty($position))
{ 
	$position='right';
} 
get_header(); 
?>
<article id="featured"> 
	<h2 class="scheme-c"><?php 
	if(!empty($header_title)){
		echo esc_attr($header_title );
	}else{
		
	echo esc_attr(get_the_title($post->ID));
	}	?></h2>
	<figure><img src="<?php echo esc_url($image);?>" alt="Placeholder" width="1400" height="420"></figure>
</article>              
<div class="blog-wrapper"> 
	<div class="container">
		<div class="row">  
			<?php	if($position == 'left') {
			  webhosty_sidebar();
			} if($position!='full'){ 
			  echo '<div class="col-sm-9">';
			} 
			while ( have_posts() ) : the_post(); 
			observePostViews(get_the_ID())?>
			<article class="single-article clearfix">
			  <?php get_template_part( 'content', 'single' ); ?>
			</article>
			<div class="commentary-container">
				<?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 endwhile; // end of the loop. 		 	
			 if($position!='full'){     
			  echo '</div>'; 
			}
			if($position =='right')	{
			  webhosty_sidebar(); 
			} ?>
		</div>
	</div>
</div>
<?php get_footer(); ?>