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

?>
<article id="post-<?php the_ID(); ?>" <?php post_class("post position-relative "); ?> > 
    <div class="date-box rounded shadow text-center bg-white position-absolute top-0 start-0 p-3 ms-3 mt-3">
        <h3 class="mb-0"><?php the_time( 'j' );?></h3>
        <p class="text-uppercase fw-medium mb-0"><?php the_time( 'M' );?></p>
    </div>
    <div class="post-preview mb-4">                            
       <?php 
        	if( has_post_thumbnail() ): 
        		the_post_thumbnail( 'shobe-blog', array( 'class' => 'img-fluid rounded') );
        	endif;
    	?>                         
    </div>
    <div class="post pb-3">
        <p class="fs-12 text-meta">
            <i class="bi bi-person-vcard"></i> <?php esc_html_e( 'By: ', 'shobe' ); ?> <?php the_author_posts_link(); ?>
            <?php if( has_category() ): ?>
                 <?php esc_html_e( '| In:', 'shobe' ); ?> <span><?php the_category( ', ' ); ?></span>
            <?php endif; ?>
            <?php esc_html_e( '| Last Updated:', 'shobe' ) ?> <?php echo get_the_date(); ?> |
            <i class="bi bi-chat-right-dots me-1"></i> 
            <a href="<?php echo esc_url( get_the_permalink());?>#comments" class="shobe_udl_n"><?php echo absint( get_comments_number() ); ?></a>
        </p>
        <h1 class="fs-22 fw-medium my-3 post-title"><?php the_title(); ?></h1> 
        
        <p class="text-muted"><?php the_content(); ?></p>
        <?php 
       
            $shobe_pagination_html = wp_link_pages(
                        array(
                        'before'    => '<nav><ul class="pagination mt-3 py-3"><li class="list-inline-item"><h5 class="text-uppercase me-2 mt-3">'.esc_html__( 'Pages:', 'shobe' ).'</h5></li>',
                        'after'     => '</ul></nav>',
                        'echo' => 0
                        )
                    ); 

            $shobe_pagination_html = str_replace( '<a', '<li class="page-item"><a class="page-link"', $shobe_pagination_html );
            $shobe_pagination_html = str_replace( '</a>', '</a></li>', $shobe_pagination_html );
            $shobe_pagination_html = str_replace( '<span', '<li class="page-item"><span class="page-link active"', $shobe_pagination_html );
            echo str_replace( '</span>', '</span></li>', $shobe_pagination_html );
        ?>
        <?php if( has_tag() ): ?>
            <div class="border-bottom">
            <?php esc_html_e( 'Tags ', 'shobe' ) ?><i class="bi bi-tags"></i> <span class="tagcloud rounded d-inline-block fs-12 "><?php the_tags( '', ', '); ?></span>
           </div>
        <?php endif;?>

        
    </div>
</article>