<?php
/**
 * Template part for displaying posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package Spiral_Lite_One_Page
 */

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
	<div class="post">
		<?php
		if ( is_singular() ) :
			the_title( '<div class="entry-title"><h2>', '</h2></div>' );
		else :
			the_title( '<div class="entry-title"><h2><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2></div>' );
		endif;

		if ( 'post' === get_post_type() ) :
			?>
			<div class="entry-meta">
				<?php
				spiral_lite_one_page_posted_on();
				spiral_lite_one_page_posted_by();
				?>
			</div><!-- .entry-meta -->
		<?php endif; ?>
		<div class="post-hover-effect">
	<?php spiral_lite_one_page_post_thumbnail(); ?>
		</div>
	<div class="entry-content">
		<?php
		if ( is_singular() ) :
		the_content(
			sprintf(
				wp_kses(
					/* translators: %s: Name of current post. Only visible to screen readers */
					__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'spiral-lite-one-page' ),
					array(
						'span' => array(
							'class' => array(),
						),
					)
				),
				wp_kses_post( get_the_title() )
			)
		);
		else :
			the_excerpt();
			echo '<a href="' . esc_url( get_permalink() ) . '" class="btn btn-medium btn-outline read-more">' . esc_html__( 'Read More', 'spiral-lite-one-page' ) . '</a>';
		endif;

		wp_link_pages(
			array(
				'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'spiral-lite-one-page' ),
				'after'  => '</div>',
			)
		);
		?>
	</div><!-- .entry-content -->

	<footer class="entry-footer">
		<?php spiral_lite_one_page_entry_footer(); ?>
	</footer><!-- .entry-footer -->
	
   <?php if( is_single() ) {?>
	<!-- .author-content -->
	<div class="author-post clearfix">
        <?php $avatar = get_avatar( get_the_author_meta( 'ID' ), $size = 75 ); ?>
        <?php if( $avatar ) : ?>
          <div class="author-image"> 
            <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"><?php echo $avatar; ?></a>
          </div>
        <?php endif; ?>
        <div class="author-details">
        <h6><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"><?php echo esc_html( get_the_author() ); ?></a></h6>
        <p><?php echo esc_html( get_the_author_meta('description') ); ?></p>
        </div> 
      </div> <!-- .author-content -->
	  <?php }?>

	</div><!-- .entry-blog -->
</article><!-- #post-<?php the_ID(); ?> -->

