<?php

get_header();
$sidebarpos = wishbone_option('page_homesidebar', 'right-sidebar');
if( 'no-sidebar' == $sidebarpos ){
	$containerclass = 'large-12 wishbone_no-sidebar';
} else {
	$containerclass = 'large-8';
}

	if( have_posts() ):
		while( have_posts() ): the_post();
		$postid = get_the_ID();
		$thumb = $img_url = '';
		if( has_post_thumbnail() ){
			$thumb = get_post_thumbnail_id(get_the_ID());
			$img_url = wp_get_attachment_url( $thumb );
		}
?>
	<!-- Article Head -->
	<div class="wishbone_widearticleheader" data-stellar-background-ratio="0.2" data-background="<?php echo esc_url( $img_url ); ?>">
		<div class="row">
			<div class="large-12 column">
				<!-- Title -->
				<?php the_title( '<h1 class="post-title">', '</h1>' ); ?>
			</div>
		</div>
	</div>

	<!-- ===================================
	CONTENT AREA
	===================================== -->
	<div class="wishbone_maincontainer">
		<div class="row">
			<?php if( $sidebarpos == 'left-sidebar' ) get_sidebar(); ?>

			<div class="<?php echo esc_attr( $containerclass ); ?> column">
				<div class="wishbone_blogwrapper">
					<article class="wishbone_typography widetemplate">
						<?php
						the_content();
						if(is_singular()){
							wp_link_pages( array(
								'before'      => '<div class="page-links"><span class="page-links-title">' . esc_html__( 'Pages:', 'jt-wishbone' ) . '</span>',
								'after'       => '</div>',
								'link_before' => '<span>',
								'link_after'  => '</span>',
							) );
						}
						 ?>
					</article>
				</div>

				<!-- Comments -->
				<?php
					if ( comments_open() || get_comments_number() ) {
						echo '<div class="wishbone_commentboxwrapper"><div class="wishbone_comment_container">';
						comments_template();
						echo '</div></div>';
					}
				?>
			</div> <!-- end .large-8 column -->

			<?php if( $sidebarpos == 'right-sidebar' ) get_sidebar(); ?>

			<div class="clear"></div>
		</div> <!-- end .row -->
		<div class="clear"></div>
	</div>
	<?php
		endwhile;
	endif; ?>
<?php get_footer(); ?>
