<?php
/**
 * Card type 1 template
 *
 * @package wpstream-theme
 */

?>

<div class="col-md-6 col-lg-4 mb-4">

	<div class="card h-100">

		<?php the_post_thumbnail( 'medium', array( 'class' => 'card-img-top' ) ); ?>

		<div class="card-body d-flex flex-column">

			<div class="mb-2">

				<?php
				$the_list = array();
				foreach ( get_the_category() as $i => $category ) {
					$the_list[] = '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" class="badge badge-secondary">' . $category->name . '</a>';
				}
				echo implode( ' ', $the_list );//phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
				?>
			</div>

			<h2 class="blog-post-title">
				<a href="<?php the_permalink(); ?>">
					<?php the_title(); ?>
				</a>
			</h2>

			<?php if ( 'post' === get_post_type() ) : ?>

				<small class="text-muted mb-2">
					<?php
					wpstream_theme_date();
					wpstream_theme_author();
					wpstream_theme_comments();
					wpstream_theme_edit();
					?>
				</small>

			<?php endif; ?>

			<div class="card-text mt-auto">
				<?php the_excerpt(); ?>
				<a class="read-more" href="<?php echo esc_url( get_the_permalink() ); ?>"><?php esc_html_e( 'Read more', 'hello-wpstream' ); ?></a>
			</div>

			<?php wpstream_theme_tags(); ?>

			<?php
			if ( 'product' === get_post_type() ) {
				do_action( 'woocommerce_after_shop_loop_item_title' );
				do_action( 'woocommerce_after_shop_loop_item' );
			}
			?>

		</div><!-- card-body -->

	</div><!-- card -->

</div><!-- col -->