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

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

    <div class="footer-widget">
        <div class="container">
        <div class="row">
            <!-- Footer 1 -->
            <div class="<?php echo esc_attr($smallbiz_startup_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', 'smallbiz-startup'); ?>">
                        <h3 class="widget-title"><?php esc_html_e('Categories', 'smallbiz-startup'); ?></h3>
                        <ul>
                            <?php wp_list_categories('title_li='); ?>
                        </ul>
                    </aside>
                <?php endif; ?>
            </div>

            <!-- Footer 2 -->
            <div class="<?php echo esc_attr($smallbiz_startup_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', 'smallbiz-startup'); ?>">
                        <h3 class="widget-title"><?php esc_html_e('Archives', 'smallbiz-startup'); ?></h3>
                        <ul>
                            <?php wp_get_archives(array('type' => 'monthly')); ?>
                        </ul>
                    </aside>
                <?php endif; ?>
            </div>

            <!-- Footer 3 -->
            <div class="<?php echo esc_attr($smallbiz_startup_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', 'smallbiz-startup'); ?>">
                        <h3 class="widget-title"><?php esc_html_e('Meta', 'smallbiz-startup'); ?></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($smallbiz_startup_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', 'smallbiz-startup'); ?>">
                        <h3 class="widget-title"><?php esc_html_e('Search', 'smallbiz-startup'); ?></h3>
                        <?php the_widget('WP_Widget_Search'); ?>
                    </aside>
                <?php endif; ?>
            </div>
        </div>
        </div>
    </div>

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

  <div class="copywrap text-center <?php if( get_theme_mod( 'smallbiz_startup_sticky_copyright_enable', false) == 1) { ?> sticky-copyright<?php } else { ?>close-sticky <?php } ?>">
  	<div class="container">
      <p>
        <a href="<?php 
          $smallbiz_startup_copyright_link = get_theme_mod('smallbiz_startup_copyright_link', '');
          if (empty($smallbiz_startup_copyright_link)) {
              echo esc_url(SMALLBIZ_STARTUP_FOOTER_LINK);
          } else {
              echo esc_url($smallbiz_startup_copyright_link);
          } ?>" target="_blank">
          <?php echo esc_html(get_theme_mod('smallbiz_startup_copyright_line', __('Startup WordPress Theme', 'smallbiz-startup'))); ?>
        </a> 
        <?php echo esc_html('By Classic Templates', 'smallbiz-startup'); ?>
      </p>
    </div>
  </div>
</div>

<?php if(get_theme_mod('smallbiz_startup_scroll_hide',true)){ ?>
    <a id="button"><?php echo esc_html( get_theme_mod('smallbiz_startup_scroll_text',__('TOP', 'smallbiz-startup' )) ); ?></a>
<?php } ?>
<?php if(get_theme_mod('smallbiz_startup_progress_bar', false)){ ?>
    <div id="progress-bar"></div>
<?php } ?>   
<?php wp_footer(); ?>
</body>
</html>