<?php
/**
 * Template part for displaying posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package CRT_Builder_With_Elementor
 */
?>
<?php
//    $get_thumbnail_url = get_the_post_thumbnail_url( get_the_ID() );
    $crt_builder_with_elementor_get_thumbnail_url = get_the_post_thumbnail_url( get_the_ID(), 'crt-builder-with-elementor-image-medium' );
    $get_permalink = get_permalink();
    $post = get_post();
    $post_format = get_post_format($post) ? : 'standard';
    $crt_builder_with_elementor_attr_align = get_theme_mod('crt_manage_general_post_item_align', 'text-left');
    $crt_builder_with_elementor_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($crt_builder_with_elementor_attr_align); ?>">
            <div class="post-masonry__image">
                <a href="<?php echo esc_html($get_permalink); ?>">
                    <img src="<?php echo esc_html($crt_builder_with_elementor_get_thumbnail_url); ?>" alt="<?php echo get_the_title() ?>" />
                </a>
            </div>
            <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 crt_builder_with_elementor_entry_options($post, array('class' => 'mb-2', 'entry_date' => true, 'entry_cat' => true, 'entry_author' => true)); ?>
                    <?php if($crt_builder_with_elementor_enable_excerpt): ?>
                    <div class="post-masonry__sub">
                        <?php echo get_the_excerpt(get_the_ID()); ?>
                    </div>
                    <?php endif; ?>
                    <?php crt_builder_with_elementor_button_view_more() ?>
                </div>
            </div>
        </div>
    <?php else: ?>
        <div class="post-masonry__content">
            <?php crt_builder_with_elementor_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 crt_builder_with_elementor_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','crt-builder-with-elementor' ); ?></a>
            </div>
        </div>
        <div class="bg-cover"></div>
    <?php endif; ?>
</div>
