<?php
/**
 * There are three widget areas just above the footer.
 * If you add widgets to just one of these areas the widget(s) added will stretch across the full-width of the screen.
 * If you add widgets to any two of these areas the widget(s) added will stretch across half of the width of the screen.
 * If you add widgets to all three of these areas the widget(s) added will stretch across a third of the width of the screen.
 * @package tweaker5
**/
 ?>

			<?php
			// Just how many sidebars are active?
			$active_sidebars = 0;
			for ( $count=1; $count<=3; $count++ ) {
				if ( is_active_sidebar( 'footer-sidebar-' . $count ) ) {
					$active_sidebars++;
				}
			}
			// How many grids are needed
			if ( $active_sidebars > 0 ): ?>
				<?php $grid_class = "col grid-" . 12 / $active_sidebars;
				// Display the active footer sidebars
				for ( $count=1; $count<=3; $count++ ) {
					if ( is_active_sidebar( 'footer-sidebar-'. $count ) ) : ?>
						<div class="<?php echo $grid_class; ?> ">
							<?php dynamic_sidebar( 'footer-sidebar-'. $count ); ?>
						</div>
					<?php endif;
				}

			endif; ?>