<?php
/**
 * Template Name: Custom Home Page
 */
get_header();

?>
<!-- banner section -->
<main id="maincontent" role="main">
  <?php do_action( 'chartered_accountant_above_banner' ); ?>
  <?php if (get_theme_mod('chartered_accountant_hide_show_banner_section', true)== 1 || get_theme_mod( 'chartered_accountant_resp_slider_hide_show', true) == 1) { ?>
    <section id="banner-sec" data-wow-delay=".25s">
      <div class="row">
        <div class="col-xxl-1 col-xl-1 col-lg-1 col-md-2 col-12 banner-left position-relative">
          <div class="banner-cont-left">
            <?php if (get_theme_mod('chartered_accountant_banner_left_top_text') != '') { ?>
              <p class="banner-small-title text-capitalize mb-0"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_left_top_text')); ?></p>
            <?php } ?>
            <div class="banner-social-icon">
              <?php if ( is_active_sidebar( 'social-widget-banner' ) ) : ?>                
                <?php dynamic_sidebar('social-widget-banner'); ?>
              <?php else : ?>
                <div class="widget">
                  <div class="custom-social-icons" >
                    <h3 class="custom_title"><?php echo esc_html('Follow Us :','chartered-accountant') ?></h3>
                    <a href="https://youtube.com" target="_blank"><i class="fa-brands fa-youtube"></i></a>
                    <a href="https://instagram.com" target="_blank"><i class="fa-brands fa-instagram"></i></a>
                    <a href="https://twitter.com" target="_blank"><i class="fa-brands fa-x-twitter"></i></a>       
                    <a href="https://dribbble.com/" target="_blank"><i class="fa-solid fa-basketball"></i></a>
                    <a href="https://facebook.com" target="_blank"><i class="fa-brands fa-facebook-f"></i></a>        
                  </div>
                </div>
              <?php endif; ?>
            </div>
            <?php if (get_theme_mod('chartered_accountant_banner_left_bottom_text') != '') { ?>
              <p class="banner-small-title text-capitalize mb-0"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_left_bottom_text')); ?></p>
            <?php } ?>
          </div>
        </div>
        <div class="col-xxl-11 col-xl-11 col-lg-11 col-md-10 col-12 ps-0">
          <div class="banner-img position-relative">
            <div class="banner-bg-img">
              <?php if ( get_theme_mod('chartered_accountant_banner_bg_image_sec') != '' ) {?>
                <div class="banner-bg">
                  <img src="<?php echo esc_url(get_theme_mod('chartered_accountant_banner_bg_image_sec')); ?>" title="<?php echo esc_attr('banner image','chartered-accountant'); ?>">
                </div>
              <?php } else { ?>
                <div class="banner-bg">
                  <img src="<?php echo esc_url(get_template_directory_uri() . '/assets/images/banner-bg.png'); ?>" title="<?php echo esc_attr('banner image','chartered-accountant'); ?>">
                </div>
              <?php }?>
            </div>
            <div class="banner-content position-absolute">
              <div class="container-fluid">
                <div class="row">
                  <div class="col-xxl-5 col-xl-5 col-lg-6 col-md-6 col-12 align-self-center">
                    <?php if (get_theme_mod('chartered_accountant_banner_small_title') != '') { ?>
                      <p class="banner-small-title text-capitalize mb-2"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_small_title')); ?></p>
                    <?php } ?>
                    <?php if (get_theme_mod('chartered_accountant_banner_title') != '') { ?>
                      <h1 class="banner-title text-capitalize"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_title')); ?></h1>
                    <?php } ?>
                    <?php if (get_theme_mod('chartered_accountant_banner_text') != '') { ?>
                      <p class="banner-text text-capitalize mb-4"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_text')); ?></p>
                    <?php } ?>
                    <?php if ( get_theme_mod('chartered_accountant_banner_button_label') != '' ) {?>
                      <div class ="banner-btn">
                        <a href="<?php echo esc_url(get_theme_mod('chartered_accountant_banner_button_url'));?>" class="text-capitalize"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_button_label'));?>
                        </a>
                      </div>
                    <?php }?>
                  </div>
                  <div class="offset-xxl-2 offset-xl-2 offset-lg-1 col-xxl-5 col-xl-5 col-lg-5 col-md-6 col-12 text-center position-relative banner-left-img">
                    <?php if (get_theme_mod('chartered_accountant_banner_paid_text') != '' || get_theme_mod('chartered_accountant_banner_paid_price') != '') { ?>
                      <div class="paid-content position-absolute">
                        <p class="paid-text text-capitalize mb-2"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_paid_text')); ?></p>
                        <p class="paid-price mb-0"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_paid_price')); ?></p>
                      </div>
                    <?php }?>
                    <?php if ( get_theme_mod('chartered_accountant_banner_image_sec') != '' ) {?>
                      <div class="profile-img position-absolute">
                        <img src="<?php echo esc_url(get_theme_mod('chartered_accountant_banner_image_sec')); ?>" title="<?php echo esc_attr('banner image','chartered-accountant'); ?>">
                      </div>
                    <?php } ?>
                    <?php if (get_theme_mod('chartered_accountant_banner_tax_price') != '' || get_theme_mod('chartered_accountant_banner_text_text') != '') { ?>
                      <div class="tax-content position-absolute">
                        <div class="row">
                          <div class="col-xl-3 col-lg-3 col-md-3 col-3 align-self-center">
                            <i class="<?php echo esc_attr(get_theme_mod('chartered_accountant_banner_tax_icon','fa-solid fa-file-lines')); ?>"></i>
                          </div>
                          <div class="col-xl-9 col-lg-9 col-md-9 col-9 align-self-center text-start">
                            <p class="tax-price text-capitalize mb-0"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_tax_price')); ?></p>
                            <p class="tax-text text-capitalize mb-0"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_text_text')); ?></p>
                          </div>
                        </div>
                      </div>
                    <?php } ?>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="banner-bottom py-3">
          <div class="row">
            <?php 
              for ($chartered_accountant_i = 1; $chartered_accountant_i <= 3; $chartered_accountant_i++)
              if (get_theme_mod('chartered_accountant_banner_bottom_title' .$chartered_accountant_i) != '' || get_theme_mod('chartered_accountant_banner_bottom_text' .$chartered_accountant_i) != '') { ?>
              <div class="col-xl-3 col-lg-3 col-md-3 col-12 align-self-center pe-4 mb-lg-0 mb-md-0 mb-4">
                <div class="row">
                  <div class="col-xl-2 col-lg-2 col-md-3 col-2">
                    <i class="<?php echo esc_attr(get_theme_mod('chartered_accountant_banner_bottom_icon' .$chartered_accountant_i,'fa-solid fa-chart-column')); ?>"></i>
                  </div>
                  <div class="col-xl-10 col-lg-10 col-md-9 col-10">
                      <h6 class="banner-btm-title text-capitalize mb-0"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_bottom_title' .$chartered_accountant_i)); ?></h6>
                      <p class="banner-btm-text text-capitalize mb-0"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_bottom_text'.$chartered_accountant_i)); ?></p>
                  </div>
                </div>
              </div>
            <?php }?>
            <?php 
              if (get_theme_mod('chartered_accountant_banner_phone_text') != '' || get_theme_mod('chartered_accountant_banner_phone_number') != '') { ?>
              <div class="col-xl-3 col-lg-3 col-md-3 col-12 phone-sec align-self-center ps-5">
                <div class="row">
                  <div class="col-xl-3 col-lg-3 col-md-3 col-sm-2 col-3 align-self-center">
                    <i class="<?php echo esc_attr(get_theme_mod('chartered_accountant_banner_phone_icon','fa-solid fa-phone')); ?>"></i>
                  </div>
                  <div class="col-xl-9 col-lg-9 col-md-9 col-9 col-sm-10 align-self-center">
                    <p class="phone-title text-capitalize mb-0"><?php echo esc_html(get_theme_mod('chartered_accountant_banner_phone_text')); ?></p>
                    <a href="tel:<?php echo esc_attr( get_theme_mod('chartered_accountant_banner_phone_number') ); ?>">
                      <?php echo esc_html( get_theme_mod('chartered_accountant_banner_phone_number') ); ?>
                    </a>
                  </div>
                </div>
              </div>
            <?php }?>
          </div>
        </div>
      </div>
    </section>
  <?php }?>
  <?php do_action( 'chartered_accountant_below_banner' ); ?>

  <!-- Our Case Section -->
  <?php if (get_theme_mod('chartered_accountant_our_case_section_hide_show', true)){ ?>
    <section id="our-case-section" class="my-4 position-relative" data-wow-delay=".25s">
      <div class="container">
        <div class="our-case-content mb-3 text-center">
          <?php if(get_theme_mod('chartered_accountant_our_case_section_text') != '') {?>
            <p class="small-text mb-1 text-capitalize"><?php echo esc_html(get_theme_mod('chartered_accountant_our_case_section_text')) ?></p>
          <?php }?>
          <?php if(get_theme_mod('chartered_accountant_our_case_section_title') != '') {?>
            <h2 class="section-title text-capitalize mb-2 position-relative"><?php echo esc_html(get_theme_mod('chartered_accountant_our_case_section_title')) ?></h2>
          <?php }?>
        </div>
      </div>
      <div class="owl-carousel">
        <?php
          $chartered_accountant_catdata=  get_theme_mod('chartered_accountant_discovery_category');
          if($chartered_accountant_catdata){
          $chartered_accountant_page_query = new WP_Query(array(
            'category_name' => esc_html($chartered_accountant_catdata, 'chartered-accountant'),
          ));  
        ?>         
        <?php while( $chartered_accountant_page_query->have_posts() ) : $chartered_accountant_page_query->the_post(); ?>
          <div class="case-box position-relative">
            <div class="case-img mb-3">
              <?php if(has_post_thumbnail()){ ?>
                <?php the_post_thumbnail(); ?>
              <?php } else {?>
                <img src="<?php echo esc_url(get_template_directory_uri()) ?>/assets/images/post-image.png" alt="<?php echo esc_attr('Post Image', 'chartered-accountant'); ?>">
              <?php }?>
            </div>
            <div class="articles">
              <h3 class="case-title text-capitalize mb-2"><a href="<?php the_permalink(); ?>"><?php the_title(); ?><span class="screen-reader-text"><?php the_title(); ?></span></a></h3>
              <div class="case-text">
                <?php 
                  $chartered_accountant_excerpt = get_the_excerpt(); 
                  echo esc_html(wp_trim_words($chartered_accountant_excerpt, 20)); 
                ?>
              </div>
            </div>
          </div>
        <?php endwhile;
          wp_reset_postdata();
        }?>
      </div>
    </section>
  <?php }?>
  <?php do_action( 'chartered_accountant_after_service' ); ?>

  <div id="content-vw" class="entry-content">
    <div class="container">
      <?php while (have_posts()) : the_post(); ?>
        <?php the_content(); ?>
      <?php endwhile; // end of the loop. 
      ?>
    </div>
  </div>
</main>

<?php get_footer(); ?> 