<?php
/**
* Widget Functions.
*
* @package Cleaning Maintenance
*/


function cleaning_maintenance_widgets_init(){

	register_sidebar(array(
	    'name' => esc_html__('Main Sidebar', 'cleaning-maintenance'),
	    'id' => 'sidebar-1',
	    'description' => esc_html__('Add widgets here.', 'cleaning-maintenance'),
	    'before_widget' => '<div id="%1$s" class="widget %2$s">',
	    'after_widget' => '</div>',
	    'before_title' => '<h3 class="widget-title"><span>',
	    'after_title' => '</span></h3>',
	));


    $cleaning_maintenance_default = cleaning_maintenance_get_default_theme_options();
    $cleaning_maintenance_cleaning_maintenance_footer_column_layout = absint( get_theme_mod( 'cleaning_maintenance_footer_column_layout',$cleaning_maintenance_default['cleaning_maintenance_footer_column_layout'] ) );

    for( $cleaning_maintenance_i = 0; $cleaning_maintenance_i < $cleaning_maintenance_cleaning_maintenance_footer_column_layout; $cleaning_maintenance_i++ ){
    	
    	if( $cleaning_maintenance_i == 0 ){ $cleaning_maintenance_count = esc_html__('One','cleaning-maintenance'); }
    	if( $cleaning_maintenance_i == 1 ){ $cleaning_maintenance_count = esc_html__('Two','cleaning-maintenance'); }
    	if( $cleaning_maintenance_i == 2 ){ $cleaning_maintenance_count = esc_html__('Three','cleaning-maintenance'); }

	    register_sidebar( array(
	        'name' => esc_html__('Footer Widget ', 'cleaning-maintenance').$cleaning_maintenance_count,
	        'id' => 'cleaning-maintenance-footer-widget-'.$cleaning_maintenance_i,
	        'description' => esc_html__('Add widgets here.', 'cleaning-maintenance'),
	        'before_widget' => '<div id="%1$s" class="widget %2$s">',
	        'after_widget' => '</div>',
	        'before_title' => '<h2 class="widget-title">',
	        'after_title' => '</h2>',
	    ));
	}

}

add_action('widgets_init', 'cleaning_maintenance_widgets_init');