<?php
/**
 * Template part for displaying posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package dulcie
 */
$read_more = get_theme_mod( 'dulcie-read-more-text', __( 'Read More', 'dulcie' ));
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
	<div class="post-heading-wrap">
		<?php
			if ( is_singular() ) :
				the_title( '<h1 class="title">', '</h1>' );
			else :
				the_title( '<h2 class="title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
			endif;

			if ( 'post' === get_post_type() ) : ?>
				<!-- Post Details -->
				<ul class="post-details">
					<li><i class="la la-calendar"></i><?php dulcie_posted_on(); ?></li>
					<li><i class="la la-folder" aria-hidden="true"></i><?php dulcie_entry_meta(); ?></li>
					<li><a href="<?php echo esc_url( get_comments_link() ); ?>"><i class="la la-comment" aria-hidden="true"></i><?php comments_number(); ?></a></li>
				</ul>
				<!-- End Post Details -->
			<?php endif; ?>
	</div>
	<div class="post-media">
		<?php dulcie_post_thumbnail(); ?> 
	</div>
	<div class="post-content">
		<div class="the-excerpt">
			<?php
			if (is_singular()) {
	               the_content();
	            } else {
	               the_excerpt();
	        }
			wp_link_pages(
				array(
					'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'dulcie' ),
					'after'  => '</div>',
				)
			);
			?>
		</div><!-- .entry-content -->
		<?php
			if ( ! empty( $read_more ) ) {
				?>
				<div class="more-btn">
					<a href="<?php the_permalink(); ?>" class="btn btn-outline-custom"><?php echo esc_html( $read_more ); ?><i class="la la-arrow-right ml-2"></i></a>
				</div>
				<?php
			}
		?>
	</div>
</article><!-- #post-<?php the_ID(); ?> -->

