<?php
/**
 * Template part for displaying about section
 *
 * @package Church Services
 * @subpackage church_services
 */

?>

<?php $church_services_static_image= get_stylesheet_directory_uri() . '/assets/images/about-img.png'; ?>

<?php
if (get_theme_mod('church_services_show_hide_about_section', true) != '') : ?>
    <section id="about" class="clearfix my-md-5 my-3 px-md-0 px-2">
        <div class="container">
            <div class="row">
                <?php
                $church_services_about_page = array();
                $church_services_mod = absint(get_theme_mod('church_services_about_page'));
                if ('page-none-selected' != $church_services_mod) {
                    $church_services_about_page[] = $church_services_mod;
                }
                if (!empty($church_services_about_page)) :
                    $church_services_args = array(
                        'post_type' => 'page',
                        'post__in' => $church_services_about_page,
                        'orderby' => 'post__in',
                    );
                    $church_services_query = new WP_Query($church_services_args);
                    if ($church_services_query->have_posts()) :
                        while ($church_services_query->have_posts()) : $church_services_query->the_post(); ?>
                          <div class="col-lg-6 col-md-6 col-12 mb-md-2 mb-5 align-self-center">
                            <div class="position-relative">
                              <div class="row">
                                <div class="col-lg-7 col-md-8 position-relative">
                                  <div class="about-main-img mb-3">
                                    <?php if (has_post_thumbnail()) { ?>
                                        <img src="<?php the_post_thumbnail_url('full'); ?>" alt="<?php the_title_attribute(); ?>" />
                                    <?php } else { ?>
                                        <div class="about-color"></div>
                                    <?php } ?>
                                  </div>
                                </div>
                                <div class="col-lg-5 col-md-4 about-img px-md-0">
                                    <div class="bg-about">
                                        <?php if (get_theme_mod('church_services_abt_image') != '') { ?>
                                            <img src="<?php echo esc_url(get_theme_mod('church_services_abt_image')); ?>" alt="" />
                                        <?php } ?>
                                    </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        <?php endwhile; ?>
                        <div class="col-lg-6 col-md-6 about-box align-self-center">
                            <?php if (get_theme_mod('church_services_about_short_heading') != '') { ?>
                                <h2 class="abt-title text-uppercase"><?php echo esc_html(get_theme_mod('church_services_about_short_heading', '')); ?></h2>
                            <?php } ?>
                            <?php while ($church_services_query->have_posts()) : $church_services_query->the_post(); ?>
                                <h3 class="my-3"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                                <p class="about-content"><?php echo wp_trim_words(get_the_content(), 28); ?></p>
                                <div class="our-serv my-xl-4 my-3">
                                    <div class="row rtl-row">
                                      <?php $church_services_record = get_theme_mod('church_services_record_increament', '3');
                                        for ($church_services_i=1; $church_services_i <= $church_services_record; $church_services_i++) { ?>
                                          <div class="col-lg-4 col-md-4 col-4">
                                            <div class="record-inner-box text-center">
                                              <?php if( get_theme_mod('church_services_record_box_number'.$church_services_i) != '' ){ ?>
                                                <h3 class="trust-counter mb-1"><?php echo esc_html(get_theme_mod('church_services_record_box_number'.$church_services_i)); ?></h3>
                                              <?php }?>
                                              <?php if( get_theme_mod('church_services_record_box_title'.$church_services_i) != '' ){ ?>
                                                <p class="trust-counter-text"><?php echo esc_html(get_theme_mod('church_services_record_box_title'.$church_services_i)); ?></p>
                                              <?php }?>
                                            </div>
                                          </div>
                                        <?php } ?>
                                    </div>
                                </div>
                                <!-- <div class="our-serv my-xl-4 my-3">
                                    <div class="row">
                                        <div class="col-lg-4 col-md-4 col-4 align-self-center">
                                            <?php if (get_theme_mod('church_services_total_no_supporters') != '') { ?>
                                                <div class="text-center">
                                                    <div class="trust-counter mb-1"><?php echo esc_html(get_theme_mod('church_services_total_no_supporters', '')); ?></div>
                                                    <div class="trust-counter-text"><?php esc_html_e('Our Supporters', 'church-services'); ?></div>
                                                </div>
                                            <?php } ?>
                                        </div>
                                        <div class="col-lg-4 col-md-4 col-4 align-self-center">
                                            <?php if (get_theme_mod('church_services_total_no_amount_raised') != '') { ?>
                                                <div class="text-center">
                                                    <div class="trust-counter mb-1"><?php echo esc_html(get_theme_mod('church_services_total_no_amount_raised', '')); ?></div>
                                                    <div class="trust-counter-text"><?php esc_html_e("We've Helped Raise", 'church-services'); ?></div>
                                                </div>
                                            <?php } ?>
                                        </div>
                                        <div class="col-lg-4 col-md-4 col-4 align-self-center">
                                            <?php if (get_theme_mod('church_services_total_year_experience') != '') { ?>
                                                <div class="text-center">
                                                    <div class="trust-counter mb-1"><?php echo esc_html(get_theme_mod('church_services_total_year_experience', '')); ?></div>
                                                    <div class="trust-counter-text"><?php esc_html_e('Year Experience', 'church-services'); ?></div>
                                                </div>
                                            <?php } ?>
                                        </div>
                                    </div>
                                </div> -->
                                <div class="abt-btn mt-5 mb-3">
                                    <a href="<?php the_permalink(); ?>"><?php esc_html_e('Get Started', 'church-services'); ?></a>
                                </div>
                            <?php endwhile; ?>
                            <?php wp_reset_postdata(); ?>
                        </div>
                    <?php else : ?>
                        <div class="no-postfound"><?php esc_html_e('No posts found', 'church-services'); ?></div>
                    <?php endif; ?>
                <?php endif; ?>
                <div class="clearfix"></div>
            </div>
        </div>
    </section>
<?php endif; ?>