<?php
    $left_post = get_theme_mod('crt_manage_hero_v1_left_post');
    $right_post = get_theme_mod('crt_manage_hero_v1_right_post');
?>
<div class="container">
    <div class="hero-v3__inner d-flex">
        <div class="hero-v3_col hero-v3_col--left">
            <?php if(!empty($left_post)): ?>
                <?php foreach ( $left_post as $post_id ) {
                    $post = get_post( $post_id );
                    $get_permalink = get_permalink( $post );
                    if(wp_is_mobile()) {
                        $get_thumbnail_url = get_the_post_thumbnail_url( $post , 'matthew-magazine-blog-image-medium' );
                    } else {
                        $get_thumbnail_url = get_the_post_thumbnail_url( $post , 'matthew-magazine-blog-image-large');
                    }
                    $avatar = get_avatar($post->post_author);
                    ?>
                    <div class="hero-v3_col--item mb-4">
                        <div class="hero-v3_col--item_inner text-center">
                            <a href="<?php echo esc_attr($get_permalink); ?>">
                                <img class="lazy" data-src="<?php echo esc_attr($get_thumbnail_url); ?>" />
                            </a>
                            <?php matthew_magazine_blog_entry_options($post, array('class' => 'mt-3 justify-content-center', 'entry_date' => true, 'entry_cat' => true, 'entry_author' => true, 'entry_read_time' => false, 'entry_comment' => false, 'entry_view_count' => false)) ?>
                            <h2 class="hero-v3__title mt-2 mb-2"><a href="<?php echo esc_attr($get_permalink); ?>"><?php echo esc_html($post->post_title); ?></a></h2>
                            <div class="excerpt-default">
                                <?php echo matthew_magazine_blog_excerpt_custom(30, $post_id); ?>
                            </div>
                        </div>
                    </div>
                <?php } ?>
            <?php endif; ?>
        </div>
        <div class="hero-v3_col hero-v3_col--right">
            <?php if(!empty($right_post)): ?>
                <?php foreach ( $right_post as $post_id ) {
                    $post = get_post( $post_id );
                    $get_permalink = get_permalink( $post );
                    if(wp_is_mobile()) {
                        $get_thumbnail_url = get_the_post_thumbnail_url( $post , 'matthew-magazine-blog-image-small' );
                    } else {
                        $get_thumbnail_url = get_the_post_thumbnail_url( $post , 'matthew-magazine-blog-image-medium' );
                    }
                    ?>
                    <div class="hero-v3_col--item mb-4">
                        <div class="hero-v3_col--item_inner text-start">
                            <a href="<?php echo esc_attr($get_permalink); ?>">
                                <img class="lazy" data-src="<?php echo esc_attr($get_thumbnail_url); ?>" />
                            </a>
                            <?php matthew_magazine_blog_entry_options($post, array('class' => 'mt-2 justify-content-start', 'entry_date' => true, 'entry_cat' => true, 'entry_author' => true, 'entry_read_time' => false, 'entry_comment' => false, 'entry_view_count' => false)) ?>
                            <h2 class="hero-v3__title mt-2 mb-2"><a href="<?php echo esc_attr($get_permalink); ?>"><?php echo esc_html($post->post_title); ?></a></h2>
                            <div class="excerpt-default mt-2">
                                <?php echo matthew_magazine_blog_excerpt_custom(15, $post_id); ?>
                            </div>
                        </div>
                    </div>
                <?php } ?>
            <?php endif; ?>
        </div>
    </div>
</div>

