<?php
/**
 * The template for displaying the footer.
 *
 * Contains the closing of the #content div and all content after
 *
 * @package Solar Services
 */
?>
<div id="footer">
    <?php 
    $solar_services_footer_widget_enabled = get_theme_mod('solar_services_footer_widget', true);
    
    if ($solar_services_footer_widget_enabled !== false && $solar_services_footer_widget_enabled !== '') { ?>

    <?php 
        $solar_services_widget_areas = get_theme_mod('solar_services_footer_widget_areas', '4');
        if ($solar_services_widget_areas == '3') {
            $solar_services_cols = 'col-lg-4 col-md-6';
        } elseif ($solar_services_widget_areas == '4') {
            $solar_services_cols = 'col-lg-3 col-md-6';
        } elseif ($solar_services_widget_areas == '2') {
            $solar_services_cols = 'col-lg-6 col-md-6';
        } else {
            $solar_services_cols = 'col-lg-12 col-md-12';
        }
    ?>

    <div class="footer-widget">
        <div class="container">
          <div class="row wow bounceInUp delay-3000" data-wow-duration="2s">
            <!-- Footer 1 -->
            <div class="<?php echo esc_attr($solar_services_cols); ?> footer-block">
                <?php if (is_active_sidebar('footer-1')) : ?>
                    <?php dynamic_sidebar('footer-1'); ?>
                <?php else : ?>
                    <aside id="categories" class="widget pb-3" role="complementary" aria-label="<?php esc_attr_e('footer1', 'solar-services'); ?>">
                        <h3 class="widget-title"><?php esc_html_e('Categories', 'solar-services'); ?></h3>
                        <ul>
                            <?php wp_list_categories('title_li='); ?>
                        </ul>
                    </aside>
                <?php endif; ?>
            </div>

            <!-- Footer 2 -->
            <div class="<?php echo esc_attr($solar_services_cols); ?> footer-block">
                <?php if (is_active_sidebar('footer-2')) : ?>
                    <?php dynamic_sidebar('footer-2'); ?>
                <?php else : ?>
                    <aside id="archives" class="widget pb-3" role="complementary" aria-label="<?php esc_attr_e('footer2', 'solar-services'); ?>">
                        <h3 class="widget-title"><?php esc_html_e('Archives', 'solar-services'); ?></h3>
                        <ul>
                            <?php wp_get_archives(array('type' => 'monthly')); ?>
                        </ul>
                    </aside>
                <?php endif; ?>
            </div>

            <!-- Footer 3 -->
            <div class="<?php echo esc_attr($solar_services_cols); ?> footer-block">
                <?php if (is_active_sidebar('footer-3')) : ?>
                    <?php dynamic_sidebar('footer-3'); ?>
                <?php else : ?>
                    <aside id="meta" class="widget pb-3" role="complementary" aria-label="<?php esc_attr_e('footer3', 'solar-services'); ?>">
                        <h3 class="widget-title"><?php esc_html_e('Meta', 'solar-services'); ?></h3>
                        <ul>
                            <?php wp_register(); ?>
                            <li><?php wp_loginout(); ?></li>
                            <?php wp_meta(); ?>
                        </ul>
                    </aside>
                <?php endif; ?>
            </div>

            <!-- Footer 4 -->
            <div class="<?php echo esc_attr($solar_services_cols); ?> footer-block">
                <?php if (is_active_sidebar('footer-4')) : ?>
                    <?php dynamic_sidebar('footer-4'); ?>
                <?php else : ?>
                    <aside id="search-widget" class="widget pb-3" role="complementary" aria-label="<?php esc_attr_e('footer4', 'solar-services'); ?>">
                        <h3 class="widget-title"><?php esc_html_e('Search', 'solar-services'); ?></h3>
                        <?php the_widget('WP_Widget_Search'); ?>
                    </aside>
                <?php endif; ?>
            </div>
          </div>
        </div>
    </div>

    <?php } ?>
    <div class="clear"></div>

  <div class="copywrap text-center">
      <div class="footer-bottom">
        <?php $solar_services_social_links_present = get_theme_mod('solar_services_footer_twitter_link') || get_theme_mod('solar_services_footer_instagram_link') || get_theme_mod('solar_services_footer_pinterest_link') || get_theme_mod('solar_services_footer_facebook_link'); ?>
        <div class="container copywrap-info <?php echo $solar_services_social_links_present ? '' : 'center-content'; ?>">
          <p class="mb-0"><a href="<?php echo esc_html(get_theme_mod('solar_services_copyright_link',__('https://www.theclassictemplates.com/products/free-solar-energy-woocommerce-theme','solar-services'))); ?>" target="_blank"><?php echo esc_html(get_theme_mod('solar_services_copyright_line',__('Solar Services WordPress Theme','solar-services'))); ?></a> <?php echo esc_html('By Classic Templates','solar-services'); ?></p>
            <?php if ( $solar_services_social_links_present ) { ?>
                <div class="footer-social d-flex gap-3">
                    <?php if ( get_theme_mod('solar_services_footer_twitter_link') ) { ?> 
                        <a title="<?php echo esc_attr('twitter', 'solar-services'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('solar_services_footer_twitter_link')); ?>"><i class="fab fa-twitter"></i></a>
                    <?php } ?>
                    <?php if ( get_theme_mod('solar_services_footer_instagram_link') ) { ?> 
                        <a title="<?php echo esc_attr('instagram', 'solar-services'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('solar_services_footer_instagram_link')); ?>"><i class="fab fa-instagram"></i></a>
                    <?php } ?>
                    <?php if ( get_theme_mod('solar_services_footer_pinterest_link') ) { ?>
                        <a title="<?php echo esc_attr('pinterest', 'solar-services'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('solar_services_footer_pinterest_link')); ?>"><i class="fab fa-pinterest"></i></a>
                    <?php } ?>
                    <?php if ( get_theme_mod('solar_services_footer_facebook_link') ) { ?>
                        <a title="<?php echo esc_attr('facebook', 'solar-services'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('solar_services_footer_facebook_link')); ?>"><i class="fab fa-facebook-f"></i></a> 
                    <?php } ?>
                </div>
            <?php } ?>
        </div>
      </div>
  </div>
</div>

  <?php if(get_theme_mod('solar_services_scroll_hide', true)){ ?>
    <a id="button"><?php echo esc_html( get_theme_mod('solar_services_scroll_text',__('TOP', 'solar-services' )) ); ?></a>
  <?php } ?>

<?php wp_footer(); ?>
</body>
</html>
