<div class="container mb-0 card_box_16">
    <div class="row">
        <?php if ($settings['title']): ?>
        <div class="col-12">
            <div class="head_card_box">
                <span class="head_card_title" style="color:<?php echo $settings['box_title']; ?>">
                    <?php echo $settings['title']; ?>
                </span>
                <?php if ($settings['title_show_more']): ?>
                <a href="<?php echo $settings['website_link']['url']; ?>" class="head_card_more"
                    style="color:<?php echo $settings['box_title_redmor']; ?>">
                    <?php echo $settings['title_show_more']; ?>
                    <i class="fal fa-arrow-left"></i>
                </a>
                <?php endif; ?>
            </div>
        </div>
        <?php endif; while ($all_posts->have_posts()) :
                  $all_posts->the_post(); ?>
        <div class="col-12 mb-3">
            <article>
            <div class="row">
                <div class="col-12 col-sm-6">
                    <a href="<?php the_permalink(); ?>">
                        <div class="image_wrapper">
                            <?php the_post_thumbnail('medium_large'); ?>
                        </div>
                    </a>
                </div>
                <div class="col-12 col-sm-6">
                <div class="content_wrapper">
                        <div class="terms-wrapper">
                            <?php
                        $categories = get_the_category();
                            if ( ! empty( $categories ) ) {
                                echo '<a class="card__overload--category" href="' . esc_url( get_category_link( $categories[0]->term_id ) ) . '">' . esc_html( $categories[0]->name ) . '</a>';
                            } ?>
                        </div>
                        <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                        <?php if ('yes' === $settings['show_more_specifications']): ?>
                        <div class="meta-wrapper">
                            <div class="card__overload--info">
                            <span class="card__overload--author">
                            نویسنده <?php the_author(); ?>
                            </span>
                            <span class="card__overload--date">
                            <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' پیش'; ?>
                            </span>
                        </div>
                        </div>
                        <?php endif; if ($settings['show_excerpt_text']): ?>
                        <p class="excerpt">
                        <?php
                            $excerpt = get_the_excerpt();
                            $excerpt = substr($excerpt, 0, 300);
                            $result = substr($excerpt, 0, strrpos($excerpt, ' '));
                            echo $result,' ... ';
                            ?>
                        </p>
                        <?php endif; if ($settings['show_more']): ?>
                            <div class="read-more-wrapper">
                            <a href="<?php the_permalink(); ?>">
                                <span><?php echo $settings['title_more']; ?></span>
                                <i class="fas fa-arrow-circle-left"></i>
                            </a>
                        </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
            <article>
        </div>
        <?php endwhile; ?>
    </div>
</div>