<?php
    if ( get_theme_mod( 'prime-business-slider-switch-setting', false ) ) :

        $prime_business_dots = 'false';
        if ( get_theme_mod( 'prime-business-slider-options-setting-0', true ) ) {
            $prime_business_dots = 'true';
        }

        $prime_business_arrows = 'false';
        if ( get_theme_mod( 'prime-business-slider-options-setting-1', true ) ) {
            $prime_business_arrows = 'true';
        }

        $prime_business_fade = 'false';
        if ( get_theme_mod( 'prime-business-slider-options-setting-2', true ) ) {
            $prime_business_fade = 'true';
        }

        $prime_business_autoplay = 'false';
        if ( get_theme_mod( 'prime-business-slider-options-setting-3', true ) ) {
            $prime_business_autoplay = 'true';
        }
?>
    <div class="ct-slick" data-slick='{
                "dots": <?php echo esc_attr( $prime_business_dots ); ?>,
                "arrows": <?php echo esc_attr( $prime_business_arrows ); ?>,
                "fade": <?php echo esc_attr( $prime_business_fade ); ?>,
                "autoplay": <?php echo esc_attr( $prime_business_autoplay ); ?>,
                "autoplaySpeed": 6000,
                "pauseOnHover": false
            }' >

        <?php
            for ( $prime_business_count = 1; $prime_business_count < 5; $prime_business_count++ ) {

                $prime_business_page_title = get_theme_mod( "prime-business-slider-setting-$prime_business_count" );
                if ( ! empty( $prime_business_page_title ) ) {
        ?>
                <div class="ct-slick-slide" style="background-image: url( <?php echo esc_url( get_the_post_thumbnail_url( $prime_business_page_title, 'prime-business-1200-16x9' ) ); ?> );">
                    <div class="ct-color-mask"></div><!-- /.ct-color-mask -->
                    <div class="ct-slide-content">
                        <h1 class="<?php
                        echo esc_attr( "slider-content-$prime_business_count" );
                        ?>"><?php echo esc_html( get_the_title( $prime_business_page_title ) ); ?></h1>
                        <?php if( get_theme_mod( "prime-business-slider-excerpt-switch-setting-$prime_business_count", false ) ) : ?>
                        <p class="description"><?php echo esc_html( get_the_excerpt( $prime_business_page_title ) ); ?></p>
                        <?php endif; ?>
                        <?php
                            $prime_business_button_1     = get_theme_mod( "prime-business-slider-button1-text-setting-$prime_business_count" );
                            $prime_business_button_1_url = get_theme_mod( "prime-business-slider-button1-url-setting-$prime_business_count" );
                            if ( ! empty( $prime_business_button_1 ) ) {
                                echo '<a href="' . esc_url( $prime_business_button_1_url ) . '" class="slider-button-1">' . esc_html( $prime_business_button_1 ) . '</a><!-- /.slider-button-1 -->';
                            }

                            $prime_business_button_2     = get_theme_mod( "prime-business-slider-button2-text-setting-$prime_business_count" );
                            $prime_business_button_2_url = get_theme_mod( "prime-business-slider-button2-url-setting-$prime_business_count" );
                            if ( ! empty( $prime_business_button_2 ) ) {
                                echo '<a href="' . esc_url( $prime_business_button_2_url ) . '" class="slider-button-2">' . esc_html( $prime_business_button_2 ) . '</a><!-- /.slider-button-1 -->';
                            }
                        ?>
                    </div><!-- /.ct-slide-content -->
                </div><!-- /.ct-slick-slide -->
        <?php
                } // Endif
            } // End For
        ?>
    </div><!-- /.ct-slick -->
    <?php endif; ?>
