<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}
?>
</div><!-- end content-wrap -->
<div id="footer-wrap">
	<?php do_action('pmthemes_before_footer'); ?>
	
	<?php 
		$theme_options = pmthemes_theme_options();
		$total = $theme_options['fwidgets']; 
		if (!isset($total)) $total = 4;				   
		if ( ( is_active_sidebar('footer-widgets-1') ||
			   is_active_sidebar('footer-widgets-2') || 
			   is_active_sidebar('footer-widgets-3') || 
			   is_active_sidebar('footer-widgets-4') ) && $total > 0 ) : 
	?>	
		<div id="footer-widgets-bg">
			<div id="footer-widgets-wrap" class="container">
				<div id="footer-widgets" class="clearfix">
					<div class="footer-widgets-ins">
						<?php $i = 0; while ( $i < $total ) : $i++; ?>	
						<div class="footer-widget-column-<?php echo $total; ?>">
							<?php dynamic_sidebar('footer-widgets-'.$i); ?>
						</div>
						<?php endwhile; ?> 	
					</div>
				</div>
			</div>	
		</div>
    <?php endif; ?>	
	</div>
	<footer id="footer" class="clearfix" role="contentinfo">
	  <div class="footie">
		<div id="footer-text">	
		&copy; <?php echo date('Y'); ?> <a href="<?php echo esc_url(home_url()); ?>"><?php bloginfo(); ?></a>. <?php _e('All Rights Reserved.', 'pmthemes') ?>
			<?php do_action('pmthemes_footer_text'); ?>
		</div>
		<?php // Display Footer Navigation
		if ( has_nav_menu( 'footer' ) ) : ?>
		<nav id="footernav" class="clearfix" role="navigation">
			<?php wp_nav_menu(	array(
				'theme_location' => 'footer', 
				'container' => false, 
				'menu_id' => 'footernav-menu', 
				'fallback_cb' => '', 
				'depth' => 1)
			);
			?>
			<h5 id="footernav-icon"><?php _e('Menu', 'pmthemes'); ?></h5>
		</nav>
		<?php endif; ?>
	   </div>
	</footer>
</div><!-- end footer-wrap -->
<?php do_action('pmthemes_below_footer'); ?>
</div><!-- end #wrapper -->
<?php do_action('pmthemes_scroll_top'); ?>
<?php wp_footer(); ?>
</body>
</html>