HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/CW-techs/wp-content/themes/cw-techs/footer.php
<footer class="footer">
  <div class="container custom-container">
    <div class="row footer-col">
      <div class="f-col-1 f-col-2">
        <div class="footer-logo">
          <a href="<?= site_url(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/img/logo.svg"
              alt="Logo"></a>
        </div>
        <p class="footer-content"><span class="ico"><img src="<?php echo get_template_directory_uri(); ?>/img/loc.svg"
              alt="loc"></span>Akshya Nagar 1st Block 1st Cross,<br> Remmurthy nagar, Bangalore-560016</p>
        <a href="tel:+00 0000 0000 00">
          <p class="footer-content"><span class="ico"><img
                src="<?php echo get_template_directory_uri(); ?>/img/call.svg" alt="call"></span>+00 0000 0000 00</p>
        </a>
        <a href="mailto:cwtechinfo@gmail.com">
          <p class="footer-content"><span class="ico"><img src="<?php echo get_template_directory_uri(); ?>/img/msg.svg"
                alt="msg"></span> cwtechinfo@gmail.com</p>
        </a>
      </div>

      <?php
      // Fetch only top-level product categories (no subcategories)
      $args = array(
        'taxonomy' => 'product_cat',
        'orderby' => 'name',
        'order' => 'ASC',
        'hide_empty' => false,
        'parent' => 0, // Only parent categories
      );

      $product_categories = get_terms($args);

      // Split categories
      $first_column = array_slice($product_categories, 0, 5);
      $second_column = array_slice($product_categories, 5);

      $current_term = get_queried_object();
      $current_term_id = isset($current_term->term_id) ? $current_term->term_id : 0;
      $current_ancestors = [];

      if ($current_term && isset($current_term->taxonomy) && $current_term->taxonomy === 'product_cat') {
        $current_ancestors = get_ancestors($current_term_id, 'product_cat');
      }

      ?>

      <div class="f-col-1">
        <h5 class="ft-title">Main Menu</h5>
        <ul class="ft-lisr ft-lis1">
          <?php foreach ($first_column as $cat):
            $is_active = ($cat->term_id == $current_term_id || in_array($cat->term_id, $current_ancestors)) ? 'active' : ''; ?>
            <li>
              <a href="<?php echo esc_url(get_term_link($cat)); ?>"
                class="footer-content <?php echo esc_attr($is_active); ?>">
                <span class="ico">
                  <img src="<?php echo get_template_directory_uri(); ?>/img/ft-arrow.svg" alt="ft-arrow">
                </span>
                <?php echo esc_html($cat->name); ?>
              </a>
            </li>
          <?php endforeach; ?>
        </ul>
      </div>

      <div class="f-col-1">
        <h5 class="ft-title"></h5>
        <ul class="ft-lisr ft-lis1">
          <?php foreach ($second_column as $cat): ?>
            <li>
              <a href="<?php echo esc_url(get_term_link($cat)); ?>" class="footer-content">
                <span class="ico">
                  <img src="<?php echo get_template_directory_uri(); ?>/img/ft-arrow.svg" alt="ft-arrow">
                </span>
                <?php echo esc_html($cat->name); ?>
              </a>
            </li>
          <?php endforeach; ?>
        </ul>
      </div>


      <div class="f-col-1">
        <h5 class="ft-title">Sub Menu</h5>
        <ul class="ft-lisr ft-lis1">
          <li><a href="#" class="footer-content"><span class="ico"><img
                  src="<?php echo get_template_directory_uri(); ?>/img/ft-arrow.svg" alt="ft-arrow"></span>Terms and
              Conditions</a></li>
          <li><a href="#" class="footer-content"><span class="ico"><img
                  src="<?php echo get_template_directory_uri(); ?>/img/ft-arrow.svg" alt="ft-arrow"></span>Privacy
              Policy</a></li>
          <li><a href="<?= site_url('contact-us') ?>"
              class="footer-content <?php echo is_page('contact-us') ? 'active' : ''; ?>"><span class="ico"><img
                  src="<?php echo get_template_directory_uri(); ?>/img/ft-arrow.svg" alt="ft-arrow"></span>Contact
              Us</a></li>
        </ul>
      </div>

      <div class="f-col-1">
        <h5 class="ft-title">Follow Us</h5>
        <div class="social-icons">
          <a href="#" class="icon"><img src="<?php echo get_template_directory_uri(); ?>/img/google-1.svg"
              alt="google"></a>
          <a href="#" class="icon"><img src="<?php echo get_template_directory_uri(); ?>/img/youtube1.svg"
              alt="google"></a>
          <a href="#" class="icon"><img src="<?php echo get_template_directory_uri(); ?>/img/insta1.svg"
              alt="google"></a>
          <a href="#" class="icon"><img src="<?php echo get_template_directory_uri(); ?>/img/fb-1.svg" alt="google"></a>
          <a href="#" class="icon"><img src="<?php echo get_template_directory_uri(); ?>/img/linkedin-1.svg"
              alt="google"></a>
          <a href="#" class="icon"><img src="<?php echo get_template_directory_uri(); ?>/img/twitter-1.svg"
              alt="google"></a>
        </div>
      </div>
    </div>
    <div class="copy">
      &copy;
      <script>document.write(new Date().getFullYear());</script> Security Equipment Depot | Built by <a
        href="https://kornerstonemedia.com" target="_blank"><strong>Kornerstone Media</strong></a>
    </div>

  </div>
</footer>

<?php wp_footer(); ?>

</body>

</html>