<?php
/**
 * Template Name: Custom Home Page
 */

get_header(); 

?>

<main role="main" id="skip_content">
  <?php do_action( 'charity_welfare_funds_above_slider' ); ?>

  <?php 
    $charity_welfare_funds_number = get_theme_mod('charity_welfare_funds_slide_number');
    if($charity_welfare_funds_number != ''){
  ?>

  <?php if ( get_theme_mod( 'charity_welfare_funds_slider_hide', true ) ) { ?>
    <section id="slider" class="mw-100 m-auto p-0">
      <div id="carouselExampleIndicators" class="carousel slide <?php if ( get_theme_mod('charity_welfare_funds_slide_remove_fade',true) == 1 ) { ?> carousel-fade <?php } ?>" data-bs-ride="carousel" data-type="multi" data-interval="false">
        <div class="carousel-inner" role="listbox">
          <?php for ($charity_welfare_funds_i=1; $charity_welfare_funds_i<=$charity_welfare_funds_number; $charity_welfare_funds_i++) {?>
            <div <?php if($charity_welfare_funds_i == 1){echo 'class="carousel-item active"';} else{ echo 'class="carousel-item"';}?>>
              <?php if ( get_theme_mod('charity_welfare_funds_slider_bg_image',true) != "" ) {?>
                <img class="slider-banner-img" src="<?php echo esc_url(get_theme_mod('charity_welfare_funds_slider_bg_image'.$charity_welfare_funds_i)); ?>" alt="<?php echo esc_attr(get_theme_mod('charity_welfare_funds_slide_title'.$charity_welfare_funds_i, true)); ?>" title="#slidecaption<?php echo esc_html($charity_welfare_funds_i); ?>">
              <?php } ?>
              <div class="container">
                <div class="carousel-caption">
                  <div class="inner_carousel wow fadeInDown">
                    <?php if(get_theme_mod('charity_welfare_funds_slider_small_text'.$charity_welfare_funds_i) != ''){ ?>
                      <p class="slider-small-text mb-3"><i class="<?php echo esc_attr(get_theme_mod('charity_welfare_funds_slider_small_text_icon'.$charity_welfare_funds_i,'fa-solid fa-hand-holding-heart')); ?> me-2"></i><?php echo esc_html(get_theme_mod('charity_welfare_funds_slider_small_text'.$charity_welfare_funds_i)); ?></p>
                    <?php } ?>
                    <?php if(get_theme_mod('charity_welfare_funds_slider_title'.$charity_welfare_funds_i) != ''){ ?>
                      <h1 class="slider-title pb-0" class=""><?php echo esc_html(get_theme_mod('charity_welfare_funds_slider_title'.$charity_welfare_funds_i)); ?></h1>
                    <?php } ?>
                     <?php if(get_theme_mod('charity_welfare_funds_slider_text'.$charity_welfare_funds_i) != ''){ ?>
                      <p class="slider-text mb-4 mt-3"><?php echo esc_html(get_theme_mod('charity_welfare_funds_slider_text'.$charity_welfare_funds_i)); ?></p>
                    <?php } ?>
                    <?php if ( get_theme_mod('charity_welfare_funds_slider_btn_text'.$charity_welfare_funds_i,'Request Fund Rise') != '' ) {?>
                      <div class ="slider-btn text-center">
                        <a href="<?php echo esc_url(get_theme_mod('charity_welfare_funds_slider_btn_url'.$charity_welfare_funds_i,false));?>"><?php echo esc_html(get_theme_mod('charity_welfare_funds_slider_btn_text'.$charity_welfare_funds_i,'Request Fund Rise'));?><span class="screen-reader-text"><?php esc_html_e( 'Request Fund Rise','charity-welfare-funds');?></span><i class="<?php echo esc_attr(get_theme_mod('charity_welfare_funds_slider_btn_icon'.$charity_welfare_funds_i,'fa-solid fa-arrow-right')); ?>"></i></a>
                      </div>
                    <?php }?>
                  </div>
                </div>
              </div>
            </div>
          <?php } ?>
        </div>
        <a class="carousel-control-prev" data-bs-target="#carouselExampleIndicators" data-bs-slide="prev" role="button">
          <span class="carousel-control-prev-icon w-auto h-auto" aria-hidden="true"><i class="<?php echo esc_attr(get_theme_mod('charity_welfare_funds_slider_previous_icon','fa-solid fa-arrow-left')); ?>" ></i></span>
          <span class="screen-reader-text"><?php esc_html_e( 'Previous','charity-welfare-funds' );?></span>
        </a>
        <a class="carousel-control-next" data-bs-target="#carouselExampleIndicators" data-bs-slide="next" role="button">
          <span class="carousel-control-next-icon w-auto h-auto" aria-hidden="true"><i class="<?php echo esc_attr(get_theme_mod('charity_welfare_funds_slider_next_icon','fa-solid fa-arrow-right')); ?>" ></i></span>
          <span class="screen-reader-text"><?php esc_html_e( 'Next','charity-welfare-funds' );?></span>
        </a> 
      </div>  
      <div class="clearfix"></div>
    </section>
  <?php }}?>
  <?php do_action( 'charity_welfare_funds_below_slider' ); ?>

<!-- Charity Section -->
  <?php if( get_theme_mod( 'charity_welfare_funds_section_title') != '' || get_theme_mod( 'charity_welfare_funds_section_small_text') != '') { ?>
    <section id="charity-sec" class="py-5">
      <div class="container wow fadeInLeftBig">
        <div class="heading-box text-center mb-1">
          <?php if(get_theme_mod('charity_welfare_funds_section_small_text') != ''){ ?>
            <p><?php echo esc_html(get_theme_mod('charity_welfare_funds_section_small_text')); ?></p>
          <?php } ?>
          <?php if( get_theme_mod( 'charity_welfare_funds_section_title') != '') { ?>
            <h2 class="py-2"><?php echo esc_html(get_theme_mod('charity_welfare_funds_section_title',''));?></h2>  
          <?php } ?>
        </div>
        <?php if(class_exists('charitable')){ ?>
          <div class="campaign">
            <?php echo do_shortcode( '[campaigns]' );?>
          </div>
        <?php }?>
      </div>
    </section>
  <?php }?>

  <div class="container front-page-content mt-4">
    <?php while ( have_posts() ) : the_post(); ?>
      <div class="new-text"><?php the_content(); ?></div>
    <?php endwhile; // end of the loop. ?>
  </div>
</main>

<?php get_footer(); ?>