<?php
/**
 * Banner Section
 * 
 * @package life_coach_agency
 */

$life_coach_agency_social_icon = get_theme_mod('life_coach_agency_social_icon_setting', false);
$life_coach_agency_slider = get_theme_mod('life_coach_agency_social_slider_setting', false);
$life_coach_agency_args = array(
    'post_type' => 'post',
    'post_status' => 'publish',
    'category_name' => get_theme_mod('life_coach_agency_blog_slide_category'),
    'posts_per_page' => 3,
);
?>
<?php if ($life_coach_agency_slider) { ?>
    <div class="banner">
        <div class="owl-carousel">
            <?php
            $life_coach_agency_arr_posts = new WP_Query($life_coach_agency_args);
            if ($life_coach_agency_arr_posts->have_posts()) :
                while ($life_coach_agency_arr_posts->have_posts()) :
                    $life_coach_agency_arr_posts->the_post();
                    ?>
                    <div class="banner_inner_box">
                        <?php if (has_post_thumbnail()) { ?>
                            <img src="<?php the_post_thumbnail_url('full'); ?>"/>
                        <?php } else { ?>
                           <img src="<?php echo esc_url(get_template_directory_uri()); ?>/images/default-header.png" alt="Default Image"/>
                        <?php } ?>

                        <div class="banner_box wow zoomInUp" data-wow-duration="2s">
                            <?php if ($life_coach_agency_social_icon) { ?>
                                <div class="social-links">
                                    <?php
                                    $life_coach_agency_social_link1 = get_theme_mod('life_coach_agency_social_link_1');
                                    $life_coach_agency_social_link2 = get_theme_mod('life_coach_agency_social_link_2');
                                    $life_coach_agency_social_link3 = get_theme_mod('life_coach_agency_social_link_3');
                                    $life_coach_agency_social_link4 = get_theme_mod('life_coach_agency_social_link_4');

                                    if (!empty($life_coach_agency_social_link1)) {
                                        echo '<a class="social1" href="' . esc_url($life_coach_agency_social_link1) . '" target="_blank"><i class="fab fa-facebook-f"></i></a>';
                                    }
                                    if (!empty($life_coach_agency_social_link2)) {
                                        echo '<a class="social2" href="' . esc_url($life_coach_agency_social_link2) . '" target="_blank"><i class="fab fa-twitter"></i></a>';
                                    }
                                    if (!empty($life_coach_agency_social_link3)) {
                                        echo '<a class="social3" href="' . esc_url($life_coach_agency_social_link3) . '" target="_blank"><i class="fab fa-instagram"></i></a>';
                                    }
                                    if (!empty($life_coach_agency_social_link4)) {
                                        echo '<a class="social4" href="' . esc_url($life_coach_agency_social_link4) . '" target="_blank"><i class="fab fa-pinterest-p"></i></a>';
                                    }
                                    ?>
                                </div>
                            <?php } ?>
                            <div class="banner_content">
                                <h3 class="my-3"><?php the_title(); ?></h3>
                                <p class="mb-0"><?php echo wp_trim_words(get_the_content(), 30); ?></p>
                                <p class="btn-green mt-4">
                                    <a href="<?php echo esc_url(get_permalink($post->ID)); ?>"><?php esc_html_e('GET STARTED', 'life-coach-agency'); ?></a>
                                </p>
                            </div>
                        </div>
                    </div>
                <?php
                endwhile;
                wp_reset_postdata();
            endif;
            ?>
        </div>
    </div>
<?php } ?>
