<?php

get_header();
$sidebarpos = wishbone_option('single_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">
				<!-- Category -->
				<div class="wishbone_widecle_cat">
					<?php the_category( ' ' ) ?>
				</div>

				<!-- Title -->
				<?php the_title( '<h1 class="post-title">', '</h1>' ); ?>

				<div class="wishbone_widecle_meta">
					<a href="<?php the_permalink(); ?>">
						<?php lnr_icon('lnr-clock'); ?>
						<?php echo get_the_time(get_option('date_format'), $post->ID); ?>
					</a>
					<?php echo wishbone_get_simple_likes_button( $post->ID ); ?>
					<a href="<?php the_permalink() ?>#comments">
						<?php lnr_icon('lnr-bubble'); echo get_comments_number_text( '0', '1', false ) ?>
					</a>
				</div>
			</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">
						<?php
							if( function_exists('wishbone_post_media') ) wishbone_post_media();

							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>',
								) );
							}

							if( function_exists('wishbone_articlebottom') ){
								wishbone_articlebottom();
							}

						?>
					</article>
				</div>

				<?php

				$postnextprev = wishbone_option('postnextprev');
				$relatedposts = wishbone_option('relatedposts');

				if( function_exists('wishbone_postnavigator') && true == $postnextprev ){
					wishbone_postnavigator();
				}

				if( function_exists('wishbone_related_posts') && true == $relatedposts ){
					wishbone_related_posts( $postid );
				} ?>

				<!-- 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(); ?>
