<?php

// Theme Options 
$rilee_single_post_image_option = get_theme_mod('rilee_single_post_feat_image');
$rilee_single_post_date_option = get_theme_mod('rilee_single_post_date');
$rilee_single_post_cat_option = get_theme_mod('rilee_single_post_categories');
$rilee_single_post_tag_option = get_theme_mod('rilee_single_post_tags');
$rilee_single_related_posts_option = get_theme_mod('rilee_single_post_related_posts');

//Variables 
$rilee_single_post_image = isset($rilee_single_post_image_option) && $rilee_single_post_image_option != '' ? $rilee_single_post_image_option : 'rilee-show-feat-image';
$rilee_single_post_date = isset($rilee_single_post_date_option) && $rilee_single_post_date_option != '' ? $rilee_single_post_date_option : 'rilee-show-single-post-date';
$rilee_single_post_cat = isset($rilee_single_post_cat_option) && $rilee_single_post_cat_option != '' ? $rilee_single_post_cat_option : 'rilee-show-single-post-cat';
$rilee_single_post_tags = isset($rilee_single_post_tag_option) && $rilee_single_post_tag_option != '' ? $rilee_single_post_tag_option : 'rilee-show-tags';
$rilee_single_related_posts = isset($rilee_single_related_posts_option) && $rilee_single_related_posts_option != '' ? $rilee_single_related_posts_option : 'rilee-show-single-related-posts'; ?>

<article class="rilee-single-post  <?php post_class(); ?>" id="post-<?php the_ID(); ?>">

	<div class="rilee-post-content">

		<?php // Post Media 
		if(has_post_thumbnail() && $rilee_single_post_image == 'rilee-show-feat-image') { ?>

			<div class="rilee-post-media">
				<div class="rilee-post-media-wrapper">
					<?php the_post_thumbnail('rilee-full-thumb'); ?>
				</div>	
			</div>
			<?php	
		} 

		//Post Header ?>
		<div class="rilee-post-header">
			<?php if(has_category() && $rilee_single_post_cat == 'rilee-show-single-post-cat') { ?>
				<div class="rilee-cat">
					<?php the_category(' / '); ?>
				</div>
				<?php
			} ?>

			<h1 class="entry-title"><?php the_title(); ?></h1>

			<?php if($rilee_single_post_date == 'rilee-show-single-post-date') { ?>
				<div class="rilee-post-date">
					<a href="<?php echo esc_url(get_permalink()); ?>"><span class="post-date updated"><?php the_time( get_option('date_format') ); ?></span></a>
				</div>
				<?php
			} ?>

		</div>	

		<div class="rilee-post-entry">

			<div class="rilee-post-entry-wrapper">
				<?php the_content(); ?>
			</div>

			<?php wp_link_pages( array(
				'before' => '<div class="rilee-wp-links"><span class="page-links-title">' . esc_html__( 'Pages:', 'rilee' ) . '</span>',
				'after' => '</div>',
			)); 

			if(has_tag() && $rilee_single_post_tags == 'rilee-show-tags') { ?>

				<div class="rilee-post-tags">
					<span class="rilee-post-tags-title"><?php esc_html_e('TAGS:', 'rilee'); ?></span><?php the_tags('', '', '<br />'); ?>
				</div>
				<?php

			} ?>

		</div>

		<?php 

		if(get_the_author_meta('description')) { ?>

			<div class="rilee-post-author-box">

				<div class="rilee-author-img">
					<?php echo get_avatar( get_the_author_meta('email'), '250'); ?>
				</div>

				<div class="rilee-author-content">
					<h5><?php the_author_posts_link(); ?></h5>
					<p><?php the_author_meta('description'); ?></p>
				</div>

			</div>	
			<?php
		}	

		//Comments
		if(comments_open()) {
			comments_template( '', true );  
		} 

		//Related Posts 
		if($rilee_single_related_posts == 'rilee-show-single-related-posts') {
			locate_template(array( 'lib/templates/related_posts.php' ), true, true );
		} ?>

	</div>	

</article>