<?php

/**
 * Template part for displaying posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package Blog Eye
 */
$blog_eye_categories = get_the_category();
if ($blog_eye_categories) {
	$blog_eye_category = $blog_eye_categories[mt_rand(0, count($blog_eye_categories) - 1)];
} else {
	$blog_eye_category = '';
}
?>
<div class="col-lg-6 mb-4">
	<article id="post-<?php the_ID(); ?>" <?php post_class('blog-eye-list-item beye-grid'); ?>>
		<div class="ax-single-blog-post blog-eye-text-list">

			<?php if (has_post_thumbnail()) : ?>
				<div class="ax-single-blog-post-img">
					<a href="<?php the_permalink(); ?>">
						<?php the_post_thumbnail(); ?>
					</a>
				</div>
			<?php endif; ?>
			<div class="blog-eye-text-inner text-center">
				<div class="grid-head">
					<span class="ghead-meta list-meta">
						<?php if ('post' === get_post_type() && !empty($blog_eye_category)) : ?>
							<a href="<?php echo esc_url(get_category_link($blog_eye_category)); ?>"><?php echo esc_html($blog_eye_category->name); ?></a>
						<?php endif; ?>
					</span>
					<?php the_title('<h2 class="entry-title"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h2>'); ?>

				</div>
				<div class="blogeye-blist-content">
					<?php the_excerpt(); ?>
					<?php if ('post' === get_post_type()) :
					?>
						<div class="list-meta list-author">
							<?php blog_eye_posted_by(); ?>
						</div><!-- .entry-meta -->
					<?php endif; ?>
				</div>
				<a class="blog-eye-readmore" href="<?php the_permalink(); ?>"><?php esc_html_e('Read More ', 'blog-eye'); ?> <i class="fas fa-long-arrow-alt-right"></i></a>
			</div>
		</div>

	</article><!-- #post-<?php the_ID(); ?> -->
</div>