<?php
/**
* Widget Functions.
*
* @package Home Construction Builder
*/

function home_construction_builder_widgets_init(){

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


    $home_construction_builder_default = home_construction_builder_get_default_theme_options();
    $home_construction_builder_home_construction_builder_footer_column_layout = absint( get_theme_mod( 'home_construction_builder_footer_column_layout',$home_construction_builder_default['home_construction_builder_footer_column_layout'] ) );

    for( $home_construction_builder_i = 0; $home_construction_builder_i < $home_construction_builder_home_construction_builder_footer_column_layout; $home_construction_builder_i++ ){
    	
    	if( $home_construction_builder_i == 0 ){ $home_construction_builder_count = esc_html__('One','home-construction-builder'); }
    	if( $home_construction_builder_i == 1 ){ $home_construction_builder_count = esc_html__('Two','home-construction-builder'); }
    	if( $home_construction_builder_i == 2 ){ $home_construction_builder_count = esc_html__('Three','home-construction-builder'); }

	    register_sidebar( array(
	        'name' => esc_html__('Footer Widget ', 'home-construction-builder').$home_construction_builder_count,
	        'id' => 'home-construction-builder-footer-widget-'.$home_construction_builder_i,
	        'description' => esc_html__('Add widgets here.', 'home-construction-builder'),
	        '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', 'home_construction_builder_widgets_init');