<?php
/**
 * Template part for displaying posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package Mushava_Magazine_Blog
 */
?>
<?php
//    $get_thumbnail_url = get_the_post_thumbnail_url( get_the_ID() );
    $get_thumbnail_url = get_the_post_thumbnail_url( get_the_ID(), 'mushava-magazine-blog-image-medium' );
    $get_permalink = get_permalink();
    $post = get_post();
    $post_format = get_post_format($post) ? : 'standard';
    $attr_align = get_theme_mod('crt_manage_general_post_item_align', 'text-left');
    $enable_excerpt = get_theme_mod('crt_manage_general_post_enable_excerpt', true);
?>

<div class="post-masonry__item--inner border-default">
    <?php if($post_format != 'quote'): ?>
        <div class="position-relative <?php echo esc_attr($attr_align); ?>">
            <?php if($get_thumbnail_url): ?>
            <div class="post-masonry__image">
                <a href="<?php echo esc_html($get_permalink); ?>">
                    <img src="<?php echo esc_html($get_thumbnail_url); ?>" alt="<?php echo get_the_title() ?>" />
                </a>
            </div>
            <?php endif; ?>
            <div class="post-masonry__content">
                <div class="post-masonry__content--inner">
                    <h3 class="post-masonry__title mt-3"><a href="<?php echo esc_html($get_permalink); ?>"><?php echo get_the_title() ?></a></h3>
                    <?php mushava_magazine_blog_entry_options($post, array('class' => 'justify-content-center mb-2', 'entry_date' => true, 'entry_cat' => true, 'entry_author' => true)); ?>
                    <?php if($enable_excerpt): ?>
                    <div class="post-masonry__sub">
                        <?php echo get_the_excerpt(get_the_ID()); ?>
                    </div>
                    <?php endif; ?>
                    <?php mushava_magazine_blog_button_view_more() ?>
                </div>
            </div>
        </div>
    <?php else: ?>
        <div class="post-masonry__content">
            <?php mushava_magazine_blog_entry_options($post, array('class' => 'justify-content-center mb-3', 'entry_date' => true, 'entry_cat' => false, 'entry_author' => false)); ?>
            <h3 class="post-masonry__title"><a href="<?php echo esc_html($get_permalink); ?>"><?php echo get_the_title() ?></a></h3>
            <?php mushava_magazine_blog_entry_options($post, array('class' => 'justify-content-center mb-3', 'entry_date' => false, 'entry_cat' => true, 'entry_author' => true)); ?>
            <div class="post-masonry__sub">
                <?php echo get_the_excerpt(get_the_ID()); ?>
            </div>
            <div class="post-masonry__btn">
                <a class="button-default" href="<?php echo esc_html($get_permalink); ?>" title="<?php echo get_the_title() ?>"><?php esc_html_e( 'Discover More','mushava-magazine-blog' ); ?></a>
            </div>
        </div>
        <div class="bg-cover"></div>
    <?php endif; ?>
</div>
