<?php
/**
 * Template part for displaying posts
 *
 * @package Magenta Plus
 */

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
	<div class="card-item card-blog-post">
	<header class="entry-header">
			<?php
			if ( 'post' === get_post_type() ) :

				if (is_singular()) {
					
					do_action('magenta_plus_breadcrumbs');
				}
				
				if ( is_singular() ) :
					the_title( '<h1 class="entry-title">', '</h1>' );
				else :
					the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );
				endif;

				?>
					<div class="entry-meta">
						<?php
						magenta_plus_posted_on();
						magenta_plus_posted_by();
						?>
					</div><!-- .entry-meta -->

			<?php endif; ?>
		</header>
		<?php 
		  $magenta_plus_blog_thumbnail = absint(get_theme_mod('magenta_plus_enable_blog_post_image', 1));
		  if($magenta_plus_blog_thumbnail == 1){ 
	  	?>
			<?php if (has_post_thumbnail()) { ?>
				<div class="card-media">
					<?php magenta_plus_post_thumbnail(); ?>
				</div>
			<?php } ?>		
		<?php }?>
		<div class="entry-content">
			<?php
				if ( is_singular() ) :
					the_content();
				else :
					echo "<p>".wp_trim_words(get_the_excerpt(), 50)."</p>";
					?>
					<a href="<?php the_permalink(); ?>" class="btn read-btn text-uppercase"> <?php echo esc_html(get_theme_mod('magenta_plus_read_more_text', __('Continue Reading....', 'magenta-plus'))); ?> </a>
					<?php
				endif;
				?>


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