<?php
/**
* Widget Functions.
*
* @package Training Institute Academy
*/

function training_institute_academy_widgets_init(){

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


    $training_institute_academy_default = training_institute_academy_get_default_theme_options();
    $training_institute_academy_footer_column_layout = absint( get_theme_mod( 'training_institute_academy_footer_column_layout',$training_institute_academy_default['training_institute_academy_footer_column_layout'] ) );

    for( $i = 0; $i < $training_institute_academy_footer_column_layout; $i++ ){
    	
    	if( $i == 0 ){ $count = esc_html__('One','training-institute-academy'); }
    	if( $i == 1 ){ $count = esc_html__('Two','training-institute-academy'); }
    	if( $i == 2 ){ $count = esc_html__('Three','training-institute-academy'); }

	    register_sidebar( array(
	        'name' => esc_html__('Footer Widget ', 'training-institute-academy').$count,
	        'id' => 'training-institute-academy-footer-widget-'.$i,
	        'description' => esc_html__('Add widgets here.', 'training-institute-academy'),
	        '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', 'training_institute_academy_widgets_init');