<?php
/**
 * Template part for displaying posts.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package Golpo
 */

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
	<?php if (is_sticky()): ?>
		<div class="sticky-post"><i class="fa fa-star"></i></div>
	<?php endif; ?>
	<header class="entry-header">
		<?php if ( ! is_single() && has_post_thumbnail() ) : ?>
            <a href="<?php get_permalink(); ?>" class="post-thumbnail">
                <?php the_post_thumbnail( 'large' ); ?>
            </a>
        <?php elseif ( is_single() ) : ?>
             <?php the_post_thumbnail( 'full' ); ?>
        <?php endif; ?>

		<?php
			if ( is_single() ) {
				the_title( '<h1 class="entry-title">', '</h1>' );
			} 
			else {
				the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
			}
		?>

		<?php if ( 'post' == get_post_type() && get_theme_mod( 'golpo_enable_post_meta', true ) ) : ?>
		<div class="entry-meta">
			<?php golpo_posted_on(); ?>
		</div><!-- .entry-meta -->
		<?php endif; ?>
	</header><!-- .entry-header -->

	<div class="entry-content">
		<?php
        if ( is_single() ) {
			the_content( sprintf(
				/* translators: %s: Name of current post. */
				esc_html__( 'Read more %1$s %2$s', 'golpo' ),
				'<i class="fa fa-angle-right hidden-icon"></i><i class="fa fa-angle-right"></i>',
				the_title( '<span class="screen-reader-text">"', '"</span>', false )
			) );
            
			wp_link_pages( array(
				'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'golpo' ),
				'after'  => '</div>',
			) );
        } else {
            the_excerpt();
            ?>
            <a href="<?php echo esc_url( get_permalink() ); ?>" class="btn btn-primary read-more-btn">
                <?php esc_html_e( 'Read More', 'golpo' ); ?>
            </a>
            <?php
        }
		?>
	</div><!-- .entry-content -->

	<?php if ( get_theme_mod( 'golpo_enable_post_meta', true ) ) : ?>
	<footer class="entry-footer">
		<?php golpo_entry_footer(); ?>
	</footer><!-- .entry-footer -->
	<?php endif; ?>
</article><!-- #post-## -->
