<?php
if ( have_posts() ) : ?>
    <div class="blog-list content-post">
		<?php while ( have_posts() ) : the_post(); ?>
            <article <?php post_class( 'post-item' ); ?>>
                <div class="post-list post-inner">
					<?php if ( has_post_thumbnail() ) : ?>
                        <div class="post-thumb">
                            <a href="<?php the_permalink(); ?>" tabindex="-1">
                                <?php $thumb = Draly_Dropshipping_Starter_Helper::resize_image( get_post_thumbnail_id(), 360, 290, true );
		                        if ( ! empty( $thumb ) ) {
			                        echo wp_kses_post($thumb['img']);
		                        } else { ?>
                                    <img src="<?php echo esc_url( get_theme_file_uri( '/assets/images/placeholder.jpg' ) ) ?>"
                                         alt="<?php echo esc_attr__( 'placeholder', 'draly-dropshipping-starter' ); ?>">
		                        <?php } ?>
                            </a>
                        </div>
					<?php endif; ?>
                    <div class="post-info">
                        <div class="post-meta">
							<?php
							Draly_Dropshipping_Starter_Helper::post_author();
							Draly_Dropshipping_Starter_Helper::post_date();
							Draly_Dropshipping_Starter_Helper::post_comment();
							?>
                        </div>
						<?php Draly_Dropshipping_Starter_Helper::post_title(); ?>
                        <div class="post-content">
							<?php echo wp_trim_words( apply_filters( 'the_excerpt', get_the_excerpt() ), 15, '...' ); ?>
                        </div>
						<?php Draly_Dropshipping_Starter_Helper::post_readmore(); ?>
                    </div>
                </div>
            </article>
		<?php endwhile;
		wp_reset_postdata(); ?>
    </div>
	<?php
	global $wp_query;
	$max = $wp_query->max_num_pages;
	// Don't print empty markup if there's only one page.
	if ( $max >= 2 ) {
		echo wp_kses_post( get_the_posts_pagination(
			array(
				'screen_reader_text' => '&nbsp;',
				'before_page_number' => '',
				'prev_text'          => '<span class="fa fa-angle-left"></span>',
				'next_text'          => '<span class="fa fa-angle-right"></span>',
			)
		) );
	}
	?>
<?php else :
	get_template_part( 'content', 'none' );
endif;