<?php
/**
 * This template displays the post loop.
 *
 * @package Organic Startup
 * @since Organic Startup 1.0
 */

?>

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

	<!-- BEGIN .post-holder -->
	<div class="post-holder">

		<!-- BEGIN .article -->
		<article class="article">

			<?php if ( ! has_post_thumbnail() || '' == get_theme_mod( 'display_img_title_post', '1' )  ) { ?>
				<h1 class="entry-title"><?php the_title(); ?></h1>
			<?php } ?>

			<!-- BEGIN .entry-content -->
			<div class="entry-content">

				<?php the_content( sprintf(
					__( 'Continue Reading<span class="screen-reader-text"> "%s"</span>', 'organic-startup' ),
					get_the_title()
				) ); ?>

			<!-- END .entry-content -->
			</div>

			<?php wp_link_pages(array(
				'before' => '<p class="page-links"><span class="link-label">' . esc_html__( 'Pages:', 'organic-startup' ) . '</span>',
				'after' => '</p>',
				'link_before' => '<span>',
				'link_after' => '</span>',
				'next_or_number' => 'next_and_number',
				'nextpagelink' => esc_html__( 'Next', 'organic-startup' ),
				'previouspagelink' => esc_html__( 'Previous', 'organic-startup' ),
				'pagelink' => '%',
				'echo' => 1,
				)
			); ?>

			<p><?php edit_post_link( esc_html__( '(Edit)', 'organic-startup' ), '', '' ); ?></p>

			<!-- BEGIN .post-meta -->
			<div class="post-meta">

				<div class="post-author">
					<p><?php esc_html_e( 'By', 'organic-startup' ); ?> <span class="author vcard"><?php esc_url( the_author_posts_link() ); ?></span></p>
				</div>

				<div class="post-date">
					<p><?php organic_startup_posted_on(); ?></p>
				</div>

			<!-- END .post-meta -->
			</div>

			<!-- BEGIN .post-meta -->
			<div class="post-meta">

				<?php $tag_list = get_the_tag_list( esc_html__( ', ', 'organic-startup' ) ); if ( ! empty( $tag_list ) || has_category() ) { ?>
					<!-- BEGIN .post-taxonomy -->
					<div class="post-taxonomy">
						<p class="align-left"><?php esc_html_e( 'Category:', 'organic-startup' ); ?> <?php the_category( ', ' ); ?><p>
						<?php if ( ! empty( $tag_list ) ) { ?>
							<p class="align-right"><?php esc_html_e( 'Tags:', 'organic-startup' ); ?> <?php the_tags( '' ); ?></p>
						<?php } ?>
					<!-- END .post-taxonomy -->
					</div>
				<?php } ?>

				<!-- BEGIN .post-navigation -->
				<div class="post-navigation">

					<?php $previous_post = get_previous_post(); ?>
					<?php if ($previous_post) { ?>
						<a class="previous-post" href="<?php echo(get_permalink($previous_post)); ?>" rel="prev">
							<div class="circle-next-prev circle-prev">
								<i class="fas fa-angle-left" aria-hidden="true"></i>
							</div>
							<span><?php echo get_the_title($previous_post); ?></span>
						</a>
					<?php } ?>

					<?php $next_post = get_next_post(); ?>
					<?php if ($next_post) { ?>
						<a class="next-post" href="<?php echo(get_permalink($next_post)); ?>" rel="next">
							<span><?php echo get_the_title($next_post); ?></span>
							<div class="circle-next-prev circle-next">
								<i class="fas fa-angle-right" aria-hidden="true"></i>
							</div>
						</a>
					<?php } ?>

				<!-- END .post-navigation -->
				</div>

			<!-- END .post-meta -->
			</div>

		<!-- END .article -->
		</article>

	<!-- END .post-holder -->
	</div>

	<?php if ( comments_open() || '0' != get_comments_number() ) { comments_template(); } ?>

<?php endwhile; else : ?>

	<!-- BEGIN .post-holder -->
	<div class="post-holder">

		<!-- BEGIN .article -->
		<article class="article">

			<?php get_template_part( 'content/content', 'none' ); ?>

		<!-- END .article -->
		</article>

	<!-- END .post-holder -->
	</div>

<?php endif; ?>
