<?php global $dicom_opt;
/**
 * @package Dicom
 */

if( isset( $dicom_opt['dicom_blog_sidebar'] ) ) {
    if( $dicom_opt['dicom_blog_sidebar'] == 'dicom_without_sidebar' ) :
        $thumb_size = 'full';
    else:
        $thumb_size = 'dicom_standard_card';
    endif;
} else {
    $thumb_size = 'dicom_standard_card';
}
// Author info
$get_author_id       = get_the_author_meta('ID');
$get_author_gravatar = get_avatar_url( $get_author_id );

if( isset( $dicom_opt['enable_lazyloader'] ) ):
    $is_lazyloader = $dicom_opt['enable_lazyloader'];
else:
    $is_lazyloader = true;
endif;

if( $is_lazyloader == true ):
    $lazy_class = 'smartify';
    $lazy_attr = 'sm-';
else:
    $lazy_class = '';
    $lazy_attr = '';
endif;

// Blog Column
$dicom_blog_grid = !empty($dicom_opt['dicom_blog_grid']) ? $dicom_opt['dicom_blog_grid'] : 'col-lg-12 col-md-12';
if ( !empty($_GET['dicom_blog_grid']) ) {
    $dicom_blog_grid = $_GET['dicom_blog_grid'];
}

if ( isset( $dicom_opt['blog_title'] ) ) {
    $is_post_meta       = $dicom_opt['is_post_meta'];
} else {
    $is_post_meta       = false;
} ?>

<div <?php post_class( $dicom_blog_grid ); ?>>
    <div class="single-blog-post">
        <?php if( has_post_thumbnail() ) { ?>
            <div class="entry-thumbnail">
                <a href="<?php the_permalink() ?>" class="d-block">
                    <img class="<?php echo esc_attr($lazy_class); ?>" <?php echo esc_attr($lazy_attr); ?>src="<?php the_post_thumbnail_url( $thumb_size ) ?>" alt="<?php the_title_attribute(); ?>">
                </a>
            </div>
        <?php } ?>

        <div class="post-content">
            <?php if( get_the_title() != '' ) : ?>
                <h3 class="title"><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h3>
            <?php endif; ?>

            <div class="d-flex align-items-center">
                <img class="<?php echo esc_attr($lazy_class); ?>" <?php echo esc_attr($lazy_attr); ?>src="<?php echo esc_url( $get_author_gravatar ); ?>" alt="<?php the_author(); ?>">
                <div class="info">
                    <h5><?php the_author(); ?></h5>
                    
                    <?php if( $is_post_meta  == false ) { ?>
                        <span><a href="<?php the_permalink() ?>"><?php echo wp_kses_post(get_the_date('F d, Y')) ?></a></span>
                    <?php } ?>
                </div>
            </div>
        </div>
    </div>
</div>