<?php 
/**
 * The template for displaying the Blog section on home page
 *
 *
 * Learn more: https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package Probizz
 */
?>
<?php
$post_data = array( 
    'post_type' => 'post', 
    'posts_per_page' => 5, 
    'post__not_in' => get_option( 'sticky_posts' )
    ); 
$post_data = new WP_Query( $post_data ); ?>
    <section class="blog_post space bg-color clearfix">
        <div class="container">
            <div class="section-heading heading_center animate zoomIn" data-anim-type="zoomIn" data-anim-delay="600">
                <h3 class="section-title"> <span> <?php echo esc_html( get_theme_mod( 'nineteen_blog_title','Our Blogs') ); ?> </span> </h3>
                <h2 class="section-description "> <?php echo esc_html( get_theme_mod( 'nineteen_blog_desc' ) ); ?></h2>
            </div>                           
                <div class="swiper-container blog-slider">
                <div class="swiper-wrapper">
                <?php if( $post_data->have_posts() ): while ( $post_data->have_posts() ): $post_data->the_post(); ?>
                    <div class="blog-post swiper-slide ">
                        <figure>
                            <?php if( has_post_thumbnail() ) : ?>
                            <div class="post-img"><img src="<?php the_post_thumbnail_url(); ?>" class="img-fluid " alt="img-blog">
                                <p class="post_date"> <span> <?php the_date(); ?> </span> </p>
                            </div>
                            <?php endif; ?>
                            <figcaption class="blog_post-catipon-inner text-left ">
                                <h4><?php the_title(); ?></h4>
                                <p><?php echo esc_html( substr( get_the_excerpt(), 0, get_theme_mod( 'excerpt_blog', 200 ) ) ); ?> [...]</p>
                                <a class="btn main-btn" href="<?php the_permalink(); ?>"> <?php _e( 'View Article','nineteen' ); ?> <i class="fas fa-long-arrow-alt-right"></i> </a>
                            </figcaption>
                        </figure>
                    </div>
                <?php endwhile; ?>
                <?php wp_reset_postdata(); ?>
                <?php endif; ?>
                </div>        
                <div class="swiper-btn-center">
                    <div class="swiper-button-prev swiper-button-white"></div>
                    <div class="swiper-button-next swiper-button-white"></div>
                </div>
            </div>
        </div>
    </section>