<?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 Cosmic Blog
 */

if ( ! is_front_page() || is_home() ) {
	?>
</div>
</div>
</div>
	<?php
}

?>

<footer class="site-footer">
	<div class="section-wrapper">
		<div class="cosmic-blog-middle-footer">
			<div class="middle-footer-wrapper four-column">
				<?php for ( $i = 1; $i <= 4; $i++ ) { ?>
					<div class="footer-container-wrapper">
						<div class="footer-content-inside">
							<?php dynamic_sidebar( 'footer-widget-' . $i ); ?>
						</div>
					</div>
				<?php } ?>
			</div>	
		</div>
		<div class="cosmic-blog-bottom-footer">
			<?php $social_menu_class = has_nav_menu( 'social' ) ? '' : 'no-social-menu'; ?>
			<div class="bottom-footer-content <?php echo esc_attr( $social_menu_class ); ?>">
				<?php

					/**
					 * Hook: cosmic_blog_footer_copyright.
					 *
					 * @hooked - cosmic_blog_output_footer_copyright_content - 10
					 */
					do_action( 'cosmic_blog_footer_copyright' );

				?>
					<div class="header-social-icon">
						<div class="header-social-icon-container">
							<?php
							if ( has_nav_menu( 'social' ) ) {
								wp_nav_menu(
									array(
										'container'      => 'ul',
										'menu_class'     => 'social-links',
										'theme_location' => 'social',
										'link_before'    => '<span class="screen-reader-text">',
										'link_after'     => '</span>',
									)
								);
							}
							?>
						</div>
					</div>
				</div>
			</div>
		</div>
	</footer>

	<?php
	$scroll_top_text_label = get_theme_mod( 'cosmic_blog_scroll_top_text_label', __( 'Scroll top', 'cosmic-blog' ) );
	?>

	<a href="#" class="scroll-to-top">
		<span class="button-caption"><?php echo esc_html( $scroll_top_text_label ); ?></span>
		<span class="arrow-icon"></span>
	</a>

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

<?php wp_footer(); ?>

</body>
</html>
