<?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 Code_Manas
 */

		
	$sidebar_count = code_manas_count_active_footer_sidebars();
	if ( $sidebar_count ) : ?>
		<div id="footer-widgets">
			<div class="container">
				<?php 
				for ( $i=2; $i < 6; $i++ ) {  
					if ( is_active_sidebar( 'sidebar-' . $i ) ) :
					?>
						<div class="footer-widget-area col-sm-<?php echo absint( $sidebar_count ); ?>">
							<?php dynamic_sidebar( 'sidebar-' . $i ); ?>
						</div>
					<?php 
					endif;
				} 
				?>
			</div><!-- .container -->
		</div>
	<?php endif; ?>

	<footer id="colophon" class="site-footer" role="contentinfo">
		<div class="container">
			<div class="site-footer-inner">
				<div class="site-footer-left">
					<div class="copyright">
						<?php
						$defaults = cm_kirki_fields()->get_theme_mods_defaults();
						echo wp_kses_post( get_theme_mod( 'footer_copyright', $defaults['footer_copyright'] ) );
						?>
					</div><!-- .copyright -->
				</div> <!-- .site-footer-left -->
				<?php if ( has_nav_menu( 'menu-3' )  ) : ?>
					<div class="site-footer-right">
						<div class="footer-social">
							<?php
							wp_nav_menu( array(
								'theme_location' => 'menu-3',
								'menu_id'        => 'social-menu',
								'menu_class'        => 'menu',
								'container'		=> 'div',
								'container_class'		=> 'widget manas-social-menu',
								'link_before'    => '<span class="screen-reader-text">',
								'link_after'     => '</span>',
							) );
							?>
						</div>
					</div> <!-- site-footer-right -->
				<?php endif; ?>
			</div><!-- site-footer-inner -->
		</div><!-- .container -->
	</footer><!-- #colophon -->

	<?php if( get_theme_mod( 'scroll_up_enable', 1 ) ) : ?>
		<a href="#" id="scroll-top" title="scroll-top">&uarr;</a>
	<?php endif; ?>

</div><!-- #page -->

<?php wp_footer(); ?>

</body>
</html>
