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

$theme_options = omag_theme_options();

if( 1 === $theme_options['enable_scroll_top'] ){

?>

<div class="scrolltop">
	<span class="fas fa-level-up-alt"></span>
</div>

<?php } ?>

		<footer>

		<?php 
		$sidebar_names = array('footer-1', 'footer-2', 'footer-3' );

	    $widget_count = omag_widget_count( $sidebar_names );

	    if( 0 < $widget_count ): ?>

			<div class="footer-top">
				<div class="container">
					<div class="row">


						<?php 
			            $column_class = '';

			            if( 1  === $widget_count ){
			                $column_class = 'col-lg-12 col-md-12';
			            } elseif( 2  === $widget_count ){
			                $column_class = 'col-lg-6 col-md-6';
			            } elseif( 3  === $widget_count ){
			                $column_class = 'col-lg-4 col-md-4';
			            }
			        	foreach ($sidebar_names as $key => $value) {

			            	if( is_active_sidebar( $value ) ){ ?>

			            	<div class="<?php echo esc_attr( $column_class ); ?>r">

                                    <?php dynamic_sidebar( $value ); ?>

			            	    </div><!-- .col -->

			            <?php } } ?>


					</div>
				</div>
			</div>

		<?php endif; ?>




			<div class="footer-bot">
				<div class="container">

				<div class="float-left">

				<?php

              			echo esc_html( $theme_options['copyright_text'] );

              			if(!empty( $theme_options['copyright_text'] )) {
          		?>

          		<span class="sep"> | </span>

				<?php } ?>

				<?php
				/* translators: 1: Theme name, 2: Theme author. */
				printf( esc_html__( 'Theme: %1$s by %2$s', 'omag' ), 'OMag', '<a href="https://www.lilyturfthemes.com/">LilyTurf Themes</a>' );
				?>

				</div>


						<?php

						if( 1 === $theme_options['enable_footer_nav'] ){ ?>

						<?php
                    if ( has_nav_menu( 'footer' ) ) {

                      wp_nav_menu( array(
                        'theme_location'  => 'footer',
                        'depth'       => 1,
                        'container'     => 'div',
                        'container_class' => 'float-right',
                    ) );

                    }
                }

                ?>

					<div class="clearfix"></div>
				</div>
			</div>
		</footer>
		<!-- Footer end -->

		<?php
			if( 'boxed' == $theme_options['site_layout'] ){
		?>

			</div>
			</div>

		<?php } ?>
		
	<?php wp_footer(); ?>

	</body>
</html>