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

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
	<?php if ( '' != get_the_post_thumbnail() ) : ?>
		<div class="post-thumbnail">
            <?php if ( !is_single() ){ ?>
			<a href="<?php the_permalink(); ?>">
				<?php the_post_thumbnail( 'iwthemesfw-featured-image' ); ?>
			</a>
            <?php
                }else{
                    the_post_thumbnail( 'full' );
                }
            ?>
		</div>
	<?php endif; ?>

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

		if ( 'post' === get_post_type() ) : ?>
		<?php get_template_part( 'components/post/content', 'meta' ); ?>
		<?php
		endif; ?>
	</header>

    <div class="entry-content">
        <?php
            if ( is_single() ) {

                the_content( sprintf(
                    /* translators: %s: Name of current post. */
                    wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'megahost' ), array( 'span' => array( 'class' => array() ) ) ),
                    the_title( '<span class="screen-reader-text">"', '"</span>', false )
                ) );

                wp_link_pages( array(
                    'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'megahost' ),
                    'after'  => '</div>',
                ) );

            } else {
                the_excerpt();
            ?>
                <a href="<?php esc_url( the_permalink() ); ?>" class="more-btn">
                    <i class="fa fa-plus-circle"></i>
                    <?php esc_html_e( 'View more', 'megahost' ); ?>
                </a>
            <?php }?>
    </div>

	<?php get_template_part( 'components/post/content', 'footer' ); ?>
</article><!-- #post-## -->
