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

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
	<div class="blog-entry">
	   <?php lusy_photography_portfolio_post_thumbnail(); ?>
	   <div class="desc">
	<div class="entry-header">
		<?php
		if ( 'post' === get_post_type() ) :
			?>
			<div class="entry-meta">
				<?php
				lusy_photography_portfolio_posted_on(); 
				?>
				<span>|</span>
				<?php
				lusy_photography_portfolio_posted_by();
				?>
			</div><!-- .entry-meta -->
		<?php endif; ?>
		<?php if ( is_singular() ) :
			the_title( '<h3 class="entry-title">', '</h3>' );
		else :
			the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );
		endif;?>
	</div><!-- .entry-header -->

	<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>', 'lusy-photography-portfolio' ),
					array(
						'span' => array(
							'class' => array(),
						),
					)
				),
				wp_kses_post( get_the_title() )
			)
		);
		else :
			the_excerpt();
			echo '<a href="' . esc_url( get_permalink() ) . '" class="underline-text">' . esc_html__( 'Read More', 'lusy-photography-portfolio' ) . '<i class="ti-arrow-right"></i></a>';
		endif;
		wp_link_pages(
			array(
				'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'lusy-photography-portfolio' ),
				'after'  => '</div>',
			)
		);
		?>
	</div><!-- .entry-content -->

	<footer class="entry-footer">
		<?php lusy_photography_portfolio_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> <!-- .end-desc -->
	</div><!-- .blog-entry -->
</article><!-- #post-<?php the_ID(); ?> -->
