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

<div class="<?php dotspice_the_theme_option( 'blog_grid' ); ?>" data-aos="fade-up">
	<article id="post-<?php the_ID(); ?>" <?php post_class( 'blog-post col-flex' ); ?>>
		<a class="blog-post__img__link" href="<?php the_permalink(); ?>">
			<?php
				if ( has_post_thumbnail() ) {
					the_post_thumbnail( array( 500, 375, 'bfi_thumb' => true ), array( 'class' => 'blog-post__img' ) );
				} else {
					echo wp_get_attachment_image( 18, array( 500, 375, 'bfi_thumb' => true ));
				}
			?>
		</a>
		<div class="blog-post__content">
			<div class="blog-post__date"><?php the_time('d.m.Y'); ?></div>
			<h2 class="blog-post__h"><a class="blog-post__h__link" href="<?php echo get_the_permalink(); ?>"><?php the_title(); ?></a></h2>
			<div class="blog-post__text">
				<?php
					if ( has_excerpt() ) {
						echo get_the_excerpt();
					} else {
						echo wp_trim_words(get_the_content(), 20);
					}
				?>
			</div>
			<div class="blog-post__btn"><a class="button" href="<?php the_permalink(); ?>"><?php esc_html_e( 'Read more', 'dotspice' ); ?></a></div>
		</div>
	</article><!-- #post-<?php the_ID(); ?> -->
</div>