<?php if (have_rows('slide')) : ?>

    <div class="slider">
        <div class="swiper-container">
            <!-- Additional required wrapper -->
            <div class="swiper-wrapper">
                <?php
                    while (have_rows('slide')) :
                        the_row();
                        $image = get_sub_field('image');
                        $title = get_sub_field('title');
                        $subtitle = get_sub_field('subtitle');
                        $link = get_sub_field('link');
                        ?>
                    <div class="swiper-slide" style="background-image: url(<?php if ($image) echo $image ?>);">
                        <div class="slider-content">
                            <div class="container">
                                <?php if ( $title ) : ?>
                                    <div class="slider-title"><?php if ($title) echo $title ?></div>
                                <?php endif; ?>
                                <?php if ( $subtitle ) : ?>
                                    <div class="slider-subtitle"><?php if ($subtitle) echo $subtitle ?></div>
                                <?php endif; ?>
                                <?php if ( $link ) : ?>
                                    <a class="btn-white" href="<?php if ($link) echo $link['url'] ?>"> <span> <?php if ($link) echo $link['title']  ?></span></a>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>

                <?php endwhile; ?>
            </div>
            <div class="swiper-prev"><i class="fa fa-chevron-left"></i></div>
            <div class="swiper-next"><i class="fa fa-chevron-right"></i></div>
        </div>
    </div>
<?php endif; ?>