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

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> style="opacity: 1;">
	<header class="entry-header">
		<?php
		if ( is_singular() ) :
			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
	if ( 'post' === get_post_type() ) :
		?>
		<div class="bottom-entry-meta-wrapper">
			<div class="entry-meta">
				<?php
				if ( ( code_manas_is_archive() && get_theme_mod( 'blog_date_enable', 1 ) ) || ( is_single() && get_theme_mod( 'post_date_enable', 1 ) ) ) {
					code_manas_posted_on();
				}

				if ( ( code_manas_is_archive() && get_theme_mod( 'blog_author_enable', 1 ) ) || ( is_single() && get_theme_mod( 'post_author_enable', 1 ) ) ) {
					code_manas_posted_by();
				}

				code_manas_entry_footer();
				?>
			</div><!-- .entry-meta -->
		</div>
	<?php endif; ?>

	<?php 
	if ( ( code_manas_is_archive() && get_theme_mod( 'blog_image_enable', 1 ) ) || ( is_single() && get_theme_mod( 'post_image_enable', 1 ) ) ) :  
		code_manas_post_thumbnail();
	endif; 
	?>

	<div class="entry-content">
		<?php
		$blog_content = get_theme_mod( 'blog_content', 'excerpt' );
		if ( code_manas_is_archive() && 'excerpt' === $blog_content ) {
			the_excerpt();
		} else {
			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>', 'code-manas' ),
					array(
						'span' => array(
							'class' => array(),
						),
					)
				),
				get_the_title()
			) );

			wp_link_pages( array(
				'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'code-manas' ),
				'after'  => '</div>',
			) );
		}
		?>
	</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->
