<?php 
/**
 * Template part for displaying Featured About Section
 *
 * @package Life Coach Agency
 */

$life_coach_agency_about = get_theme_mod( 'life_coach_agency_about_setting', false );
$life_coach_agency_featured_mission_section_title = get_theme_mod( 'life_coach_agency_featured_mission_section_title' );
$life_coach_agency_featured_mission_section_button2_text = get_theme_mod( 'life_coach_agency_featured_mission_section_button2_text' );
$life_coach_agency_featured_mission_section_button2_url = get_theme_mod( 'life_coach_agency_featured_mission_section_button2_url' );
$life_coach_agency_featured_mission_posts[] = get_theme_mod( 'life_coach_agency_featured_mission_post_' );

$life_coach_agency_featured_mission_section_text1 = get_theme_mod( 'life_coach_agency_featured_mission_section_text1' );
$life_coach_agency_featured_mission_section_text2 = get_theme_mod( 'life_coach_agency_featured_mission_section_text2' );

$life_coach_agency_default_image_url = get_template_directory_uri() . '/images/about.png'; 
?>
<?php if ( $life_coach_agency_about ){?>
<div id="about-section" class="section-content py-5">
    <div class="container">        
        <?php 
        $args = array(
            'post_type' => 'page',
            'posts_per_page' => 1,
            'post__in' => $life_coach_agency_featured_mission_posts,
            'orderby' => 'post__in',
            'ignore_sticky_posts' => true,
        );?>
        <?php
        $loop = new WP_Query($args);
        if ( $loop->have_posts() ) :
            while ( $loop->have_posts() ) : $loop->the_post(); ?>
            <div class="featured-mission-box">
                <div class="row">
                    <div class="col-lg-5 col-md-5 align-self-center wow zoomInUp delay-3000" data-wow-duration="2s">
                        <div class="image-container">
                            <?php if ( has_post_thumbnail( $post->ID ) ): ?>
                                <?php the_post_thumbnail(); ?>
                            <?php else: ?>
                                <img src="<?php echo esc_url($life_coach_agency_default_image_url); ?>" alt="<?php esc_attr_e('Default Image', 'life-coach-agency'); ?>" />
                            <?php endif; ?>
                        </div>
                    </div>
                    <div class="col-lg-7 col-md-7 align-self-center abc">
                        <header class="entry-header">
                            <?php if( !empty($life_coach_agency_featured_mission_section_title) ): ?>
                                <div class="section-title">
                                    <h3><?php echo esc_html($life_coach_agency_featured_mission_section_title); ?></h3>
                                </div>
                            <?php endif; ?>
                            <h4 class="entry-title"><?php the_title();?></h4>
                        </header>
                        <div class="entry-content">
                            <p class="mb-0"><?php echo wp_trim_words( get_the_content(), 50 ); ?></p>
                        </div>

                        <div class="info-text">
                            <?php if( !empty($life_coach_agency_featured_mission_section_text1) ): ?>
                                <h6><i class="fas fa-users"></i> <?php echo esc_html($life_coach_agency_featured_mission_section_text1); ?></h6>
                            <?php endif; ?>
                            <?php if( !empty($life_coach_agency_featured_mission_section_text2) ): ?>
                                <h6><i class="fas fa-users"></i> <?php echo esc_html($life_coach_agency_featured_mission_section_text2); ?></h6>
                            <?php endif; ?>
                        </div>

                        <div class="btn-green my-4">
                            <a href="<?php the_permalink(); ?>">
                                <?php esc_html_e('READ MORE','life-coach-agency'); ?>
                            </a>
                        </div>
                        <?php if( !empty($life_coach_agency_featured_mission_section_button2_text) ): ?>
                            <div class="btn-green btn-black my-4">
                                <a href="<?php echo esc_url($life_coach_agency_featured_mission_section_button2_url); ?>">
                                    <?php echo esc_html($life_coach_agency_featured_mission_section_button2_text); ?>
                                </a>
                            </div>
                        <?php endif; ?>

                    </div>
                </div>
            </div>
        <?php endwhile; ?>
        <?php endif; ?>
        <?php wp_reset_postdata(); ?>
    </div>
</div>
<?php } ?>
