<?php
/**
 * Post rendering content according to caller of get_template_part
 *
 * @package Wrock Metro
 */

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
?>
<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
	<div class="row g-0 border rounded overflow-hidden flex-md-row mb-4 shadow-sm position-relative">
	<?php if (get_theme_mod('wrockmetro_enable_featured') !== 'disable') { ?>
		<div class="col-auto d-lg-block">
			<?php // echo get_the_post_thumbnail( $post->ID, 'medium' ); ?>

			<a href="<?php echo esc_url( get_permalink( get_the_ID() ) ); ?>"><?php echo get_the_post_thumbnail( $post->ID, 'medium' , [ 'alt' => esc_attr( get_the_title() ), 'title' => '' ]); ?></a>				
		</div>				
	<?php } ?>
	<div class="col d-flex flex-column position-static">
	<header class="entry-header">
		<?php
		the_title(
			sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ),
			'</a></h2>'
		);
		?>
	
	</header><!-- .entry-header -->
	<?php if (get_theme_mod('wrockmetro_enable_excerpt') == 'enable') { ?>
		<div class="entry-content card-text mb-auto">
			<?php
				the_excerpt();
				wrockmetro_link_pages();
			?>
		</div><!-- .entry-content -->
	<?php } ?>
</div>

<?php 
if (get_theme_mod('wrockmetro_blog_postmeta') !== 'disable') { ?>
<div class="row post-footer">  
		<?php wrockmetro_entry_footer(); 
		if (get_theme_mod('wrockmetro_blogmeta_comments') !== 'disable') {
			wrockmetro_comments_popup_link();
		} ?>
 <?php if ( 'post' === get_post_type() ) : ?>
				<?php wrockmetro_posted_on(); ?>
				
		<?php endif; ?>
	   <?php 
	   if (get_theme_mod('wrockmetro_blog_viewcount') !== 'disable') {
	   display_post_view_count(); }
	   ?>
		<?php if (get_theme_mod('wrockmetro_enable_readmore') !== 'disable') { ?>
		<a class="read-more-link" href="<?php echo esc_url( get_permalink( get_the_ID() ) ); ?>"><?php echo	esc_attr(get_theme_mod('wrockmetro_readmore_text', 'Read More')); ?><span class="screen-reader-text"><?php echo get_the_title( get_the_ID() ); ?></span></a>
		<?php } ?>
		
        </div>
        
<?php } ?>

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