<?php
/**
 * The template for displaying the footer
 * Contains the closing of the #content div and all content after.
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 * @package Canyon Themes
 * @subpackage Sewa
 */
$copyright    = wp_kses_post(sewa_get_option('sewa_copyright'));
if ( is_active_sidebar('footer-1') || is_active_sidebar('footer-2') || is_active_sidebar('footer-3') || is_active_sidebar('footer-4') ) {
       $count = 0;
        for ( $i = 1; $i <= 4; $i++ )
            {
              if ( is_active_sidebar( 'footer-' . $i ) )
                    {
                        $count++;
                    }
            }
        $column = 3;
        if( $count == 4 )
        {
            $column = 3;
        }
        elseif( $count == 3)
        {
                $column = 4;
        }
        elseif( $count == 2)
        {
                $column = 6;
        }
        elseif( $count == 1)
        {
                $column = 12;
        }
    ?>
    <section id="footer-top" class="footer-top">
        <div class="container">
            <div class="row">
                <?php
                    for ( $i = 1; $i <= 4 ; $i++ )
                    {
                        if ( is_active_sidebar( 'footer-' . $i ) )
                        {
                ?>
                            <div class="col-md-3">
                                <div class="footer-top-box wow fadeInUp">
                                    <?php dynamic_sidebar( 'footer-' . $i ); ?>
                                </div>
                            </div>
                    <?php  }
                     }
                     ?>
            </div>
        </div>
    </section>
<?php } ?>
<section id="footer-bottom" class="footer-bottom">
    <div class="container">
        <div class="row">
            <div class="col-sm-6">
               <div class="copyright site-copyright">
                    <?php echo wp_kses_post( $copyright ); ?>
                </div>
                    <div class="footer-credit">
                        <a href="<?php echo esc_url( __( 'https://wordpress.org/', 'sewa' ) ); ?>"><?php
                            /* translators: %s: CMS name, i.e. WordPress. */
                            printf( esc_html__( 'Proudly powered by %s', 'sewa' ), 'WordPress' );
                            ?></a>
                        <span class="sep"> | </span>
                        <?php
                        /* translators: 1: Theme name, 2: Theme author. */
                        printf( esc_html__( 'Theme: %1$s by %2$s.', 'sewa' ), 'Sewa', '<a href="https://www.canyonthemes.com/">Canyon Themes</a>' );
                        ?>
                </div>
            </div>
            <div class="col-sm-6">
                <?php
                    /*
                    * Footer social Section
                    */
                    do_action('sewa_show_footer_social');
                ?>
            </div>
            <?php
                /*
                /* Footer Go to Top
                */
                do_action('sewa_go_to_top_hook');
            ?>
      </div>
    </div>
</section>
<?php wp_footer(); ?>
</body>
</html>
