<div class="wpcap-grid-container elementor-grid layout-2">
  <section>
    <section class="margin-top-50 flex landing-hero" <?php echo $this->get_render_attribute_string('background_image'); ?>>
      <div class="landing-overlay">
        <div class="digi-container container half-gut">
          <div class="digi-container guttered">
            <?php if ($settings['titlelayout_2']): ?>
              <h2 class="col" style="color:<?php echo $settings['title_color_11'] ?>;"><?php echo $settings['titlelayout_2']; ?></h2>
            <?php endif; $all_posts->the_post(); ?>
            <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12 right border-b">
              <?php if ($settings['title2layout_2']): ?>
                <h5 style="color:<?php echo $settings['title_color_21'] ?>;"><?php echo $settings['title2layout_2']; ?></h5>
              <?php endif; ?>
              <figure>
              <a href="<?php the_permalink(); ?>" class="card__picture">
                <?php
                  if (has_post_thumbnail()) {
                    the_post_thumbnail('medium_large', array('alt' => '' . get_the_title(), 'title' => '' . get_the_title() . ''));
                  } else { ?> 
                    <img src="<?php print(get_template_directory_uri()); ?>/assets/images/thumb.gif" alt="<?php _e('Image not found', 'leora'); ?>" title="<?php _e('Image not found', 'leora'); ?>">
                  <?php } ?>
                </a>
              <div class="card__overload">
                    <a href="<?php the_permalink(); ?>" class="card__overload--link"></a>
                    <div class="card__overload--categories">
                    <?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>
                    <a href="<?php the_permalink(); ?>" class="card__overload--title">
                        <?php the_title(); ?>
                    </a>
                    <div class="card__overload--info">
                        <div class="card__overload--author">
                            نوشته شده توسط <?php the_author(); ?>
                        </div>
                        <div class="card__overload--date">
                            <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' پیش'; ?>
                        </div>
                    </div>
                </div>
              </figure>
            </div>
            <?php $all_posts->the_post(); ?>
            <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12 right">
              <?php if ($settings['titlelayouttree']): ?>
                <h5 style="color:<?php echo $settings['title_color_21'] ?>;"><?php echo $settings['titlelayouttree']; ?></h5>
              <?php endif; ?>
              <ul class="article-list">
                <?php while ($all_posts->have_posts()) :
                  $all_posts->the_post(); ?>
                  <li class="flex">
                    <div class="card-trns tiny">
                      <a href="<?php the_permalink(); ?>">
                        <img class="card-thumb lazy-hoarea" <?php
                                                            if (has_post_thumbnail()) {
                                                              the_post_thumbnail('thumbnail', array('alt' => '' . get_the_title(), 'title' => '' . get_the_title() . ''));
                                                            } else { ?> <img class="card-thumb lazy-hoarea" src="<?php print(get_template_directory_uri()); ?>/assets/images/thumb.gif" alt="<?php _e('Image not found', 'leora'); ?>" title="<?php _e('Image not found', 'leora'); ?>">
                      <?php } ?>
                      <h2 class="card-title"><?php the_title(); ?></h2>
                      
                      <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>
                      </a>
                    </div>
                  </li>
                <?php endwhile; ?>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </section>
  </section>
  <?php wp_reset_postdata(); ?>
</div>