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

    <?php 
        $foodie_review_blog_widget_areas = get_theme_mod('foodie_review_blog_footer_widget_areas', '4');
        if ($foodie_review_blog_widget_areas == '3') {
            $foodie_review_blog_cols = 'col-lg-4 col-md-6';
        } elseif ($foodie_review_blog_widget_areas == '4') {
            $foodie_review_blog_cols = 'col-lg-3 col-md-6';
        } elseif ($foodie_review_blog_widget_areas == '2') {
            $foodie_review_blog_cols = 'col-lg-6 col-md-6';
        } else {
            $foodie_review_blog_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($foodie_review_blog_cols); ?> footer-block">
                <?php if (is_active_sidebar('footer-1')) : ?>
                    <?php dynamic_sidebar('footer-1'); ?>
                <?php else : ?>
                    <aside id="categories" class="widget py-3" role="complementary" aria-label="<?php esc_attr_e('footer1', 'foodie-review-blog'); ?>">
                        <h3 class="widget-title"><?php esc_html_e('Categories', 'foodie-review-blog'); ?></h3>
                        <ul>
                            <?php wp_list_categories('title_li='); ?>
                        </ul>
                    </aside>
                <?php endif; ?>
            </div>

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

            <!-- Footer 3 -->
            <div class="<?php echo esc_attr($foodie_review_blog_cols); ?> footer-block">
                <?php if (is_active_sidebar('footer-3')) : ?>
                    <?php dynamic_sidebar('footer-3'); ?>
                <?php else : ?>
                    <aside id="meta" class="widget py-3" role="complementary" aria-label="<?php esc_attr_e('footer3', 'foodie-review-blog'); ?>">
                        <h3 class="widget-title"><?php esc_html_e('Meta', 'foodie-review-blog'); ?></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($foodie_review_blog_cols); ?> footer-block">
                <?php if (is_active_sidebar('footer-4')) : ?>
                    <?php dynamic_sidebar('footer-4'); ?>
                <?php else : ?>
                    <aside id="search-widget" class="widget py-3" role="complementary" aria-label="<?php esc_attr_e('footer4', 'foodie-review-blog'); ?>">
                        <h3 class="widget-title"><?php esc_html_e('Search', 'foodie-review-blog'); ?></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 $foodie_review_blog_social_links_present = get_theme_mod('foodie_review_blog_footer_facebook_link') || get_theme_mod('foodie_review_blog_footer_twitter_link') || get_theme_mod('foodie_review_blog_footer_youtube_link') || get_theme_mod('foodie_review_blog_footer_instagram_link'); ?>
    <div class="container copywrap-info <?php echo $foodie_review_blog_social_links_present ? '' : 'center-content'; ?>">
      <p>
        <a href="<?php 
          $foodie_review_blog_copyright_link = get_theme_mod('foodie_review_blog_copyright_link', '');
          if (empty($foodie_review_blog_copyright_link)) {
              echo esc_url('https://www.theclassictemplates.com/products/free-foodie-wordpress-theme');
          } else {
              echo esc_url($foodie_review_blog_copyright_link);
          } ?>" target="_blank">
          <?php echo esc_html(get_theme_mod('foodie_review_blog_copyright_line', __('Foodie WordPress Theme', 'foodie-review-blog'))); ?>
        </a> 
        <?php echo esc_html('By Classic Templates', 'foodie-review-blog'); ?>
      </p>
      <?php if ( $foodie_review_blog_social_links_present ) { ?>
            <div class="footer-social d-flex gap-3">
                <?php if ( get_theme_mod('foodie_review_blog_footer_facebook_link') ) { ?>
                    <a title="<?php echo esc_attr('facebook', 'foodie-review-blog'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('foodie_review_blog_footer_facebook_link')); ?>"><i class="fa-brands fa-facebook-f"></i></a> 
                <?php } ?>
                <?php if ( get_theme_mod('foodie_review_blog_footer_twitter_link') ) { ?> 
                    <a title="<?php echo esc_attr('twitter', 'foodie-review-blog'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('foodie_review_blog_footer_twitter_link')); ?>"><i class="fa-brands fa-twitter"></i></a>
                <?php } ?>
                <?php if ( get_theme_mod('foodie_review_blog_footer_youtube_link') ) { ?>
                    <a title="<?php echo esc_attr('youtube', 'foodie-review-blog'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('foodie_review_blog_footer_youtube_link')); ?>"><i class="fa-brands fa-youtube"></i></a>
                <?php } ?>
                <?php if ( get_theme_mod('foodie_review_blog_footer_instagram_link') ) { ?> 
                    <a title="<?php echo esc_attr('instagram', 'foodie-review-blog'); ?>" target="_blank" href="<?php echo esc_url(get_theme_mod('foodie_review_blog_footer_instagram_link')); ?>"><i class="fa-brands fa-instagram"></i></a>
                <?php } ?>
            </div>
        <?php } ?>
    </div>
  </div>
</div>

<?php if(get_theme_mod('foodie_review_blog_scroll_hide',true)){ ?>
    <a id="button" class="scroll-btn"><?php echo esc_html( get_theme_mod('foodie_review_blog_scroll_text',__('TOP', 'foodie-review-blog' )) ); ?></a>
<?php } ?>
  
<?php wp_footer(); ?>
</body>
</html>
