<?php
/**
* Widget Functions.
*
* @package Wind Energy
*/

function wind_energy_widgets_init(){

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


    $wind_energy_default = wind_energy_get_default_theme_options();
    $wind_energy_footer_column_layout = absint( get_theme_mod( 'wind_energy_footer_column_layout',$wind_energy_default['wind_energy_footer_column_layout'] ) );

    for( $wind_energy_i = 0; $wind_energy_i < $wind_energy_footer_column_layout; $wind_energy_i++ ){
    	
    	if( $wind_energy_i == 0 ){ $wind_energy_count = esc_html__('One','wind-energy'); }
    	if( $wind_energy_i == 1 ){ $wind_energy_count = esc_html__('Two','wind-energy'); }
    	if( $wind_energy_i == 2 ){ $wind_energy_count = esc_html__('Three','wind-energy'); }

	    register_sidebar( array(
	        'name' => esc_html__('Footer Widget ', 'wind-energy').$wind_energy_count,
	        'id' => 'wind-energy-footer-widget-'.$wind_energy_i,
	        'description' => esc_html__('Add widgets here.', 'wind-energy'),
	        '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', 'wind_energy_widgets_init');