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

?>

<article id="post-<?php the_ID(); ?>" <?php post_class('post-content'); ?>>

	<?php
	if ( is_sticky() && is_home() && ! is_paged() ) {
		printf( '<span class="sticky-post">%s</span>', __( 'Featured', 'super-blog' ) );
	} 

	super_blog_featured_image_disaplay(); ?>

	<?php $block_class = ( has_post_thumbnail()) ? 'featured-img' : 'no-img'; ?>
	
	<div class="post_block <?php echo esc_attr( $block_class ); ?>">
		<div class="content-wrap">
			<header class="entry-header">
				<?php

				$meta = get_theme_mod('meta', 0);

				if ( 'post' === get_post_type() && ( 1 !== absint( $meta ) ) ) : ?>
				<div class="entry-meta">
					<?php 
					super_blog_posted_on(); 
					super_blog_entry_footer();
					?>
				</div><!-- .entry-meta -->
				<?php
				endif;

				

				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>' );
				endif;

				?>			
			</header><!-- .entry-header -->

			<?php 
			$post_option = get_theme_mod('format','post-excerpt');

			if( 'full-post' === $post_option ){

				$entry_class = 'entry-content full-entry';

			} else{

				$entry_class = 'entry-content excerpt-entry';

			} ?>

			<div class="<?php echo esc_attr( $entry_class ); ?>">
				<?php					

				if( 'full-post' === $post_option || is_single() ){
					the_content( sprintf(
						/* translators: %s: Name of current post. */
						wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'super-blog' ), array( 'span' => array( 'class' => array() ) ) ),
						the_title( '<span class="screen-reader-text">"', '"</span>', false )
					) );
				} elseif( 'post-excerpt' === $post_option ){

					the_excerpt( sprintf(
						/* translators: %s: Name of current post. */
						wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'super-blog' ), 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:', 'super-blog' ),
					'after'  => '</div>',
				) );
				?>
			</div><!-- .entry-content -->
			
		</div><!-- .content-wrap -->
	</div>
</article><!-- #post-## -->
