<?php
/**
 * The template for displaying all single recipes.
 *
 * @package thim
 */
?>

<?php while ( have_posts() ) :the_post(); ?>

	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
		<?php thim_recipe_video_upload(); ?>
		<?php thim_recipe_video_url(); ?>
		<div class="recipe-gallery">
			<?php thim_recipe_gallery(); ?>
		</div>
		<header class="entry-header">
			<?php the_title( '<h1 class="name-recipe">', '</h1>' ); ?>
			<div class="other-media">
				<a href="mailto:<?php echo get_option( 'admin_email' ); ?>"><i class="fa fa-envelope"></i></a>
				<a href="javascript:window.print()" class="print"><i class="fa fa-print"></i></a>
			</div>
			<div class="entry-meta">
				<?php thim_recipe_posted_on(); ?>
			</div>
			<div class="recipe-other">
				<?php thim_recipe_other(); ?>
			</div>
			<!-- .entry-meta -->
		</header>
		<!-- .entry-header -->
		<div class="main-content">
			<div class="row">
				<div class="col-md-8 instructions">
					<div class="entry-content">
						<h3 class="introduction-recipe"><?php echo esc_html__( 'INSTRUCTIONS', 'cakeart' ); ?></h3>
						<?php the_content(); ?>
					</div>
					<!-- .entry-content -->
					<div class="recipe-instructions">
						<?php thim_recipe_instructions(); ?>
					</div>
					<div class="sharing">
						<?php do_action( 'thim_social_share' ) ?>
						<?php if ( function_exists( 'wpfp_link' ) ) {
							wpfp_link();
						} ?>
					</div>
				</div>

				<div class="col-md-4">
					<?php if ( is_plugin_active( 'comment-rating-stars/comment-star-reviews.php' ) ) : ?>
						<div class="recipe-ratings">
							<h3 class="rating-title"><?php echo esc_html__( 'RECIPE RATING', 'cakeart' ); ?></h3>
							<?php echo csr_get_overall_rating_stars( get_the_ID() ); ?>
							<?php $rating_count = csr_get_rating_count( get_the_ID() ); ?>
							<?php
							if ( $rating_count < 2 ) {
								echo '( ' . $rating_count . esc_html__( ' Rating', 'cakeart' ) . ' )';
							} else {
								echo '( ' . $rating_count . esc_html__( ' Ratings', 'cakeart' ) . ' )';
							}
							?>
						</div>
					<?php endif; ?>
					<div class="ingredients">
						<h3 class="ingredients-title"><?php echo esc_html__( 'INGREDIENTS', 'cakeart' ); ?></h3>

						<div class="content-container">
							<div class="list-ingredients">
								<?php thim_recipe_ingredients(); ?>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<?php thim_related_recipe(); ?>
	</article><!-- #post-## -->

	<div class="recipe-comments">
		<?php
		// If comments are open or we have at least one comment, load up the comment template
		if ( comments_open() || '0' != get_comments_number() ) :
			comments_template();
		endif;
		?>
	</div>

<?php endwhile; // end of the loop.  ?>
