<?php
/**
* Widget Functions.
*
* @package Cargo And Shipping Company
*/

function cargo_and_shipping_company_widgets_init(){

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


    $cargo_and_shipping_company_default = cargo_and_shipping_company_get_default_theme_options();
    $cargo_and_shipping_company_cargo_and_shipping_company_footer_column_layout = absint( get_theme_mod( 'cargo_and_shipping_company_footer_column_layout',$cargo_and_shipping_company_default['cargo_and_shipping_company_footer_column_layout'] ) );

    for( $cargo_and_shipping_company_i = 0; $cargo_and_shipping_company_i < $cargo_and_shipping_company_cargo_and_shipping_company_footer_column_layout; $cargo_and_shipping_company_i++ ){
    	
    	if( $cargo_and_shipping_company_i == 0 ){ $cargo_and_shipping_company_count = esc_html__('One','cargo-and-shipping-company'); }
    	if( $cargo_and_shipping_company_i == 1 ){ $cargo_and_shipping_company_count = esc_html__('Two','cargo-and-shipping-company'); }
    	if( $cargo_and_shipping_company_i == 2 ){ $cargo_and_shipping_company_count = esc_html__('Three','cargo-and-shipping-company'); }

	    register_sidebar( array(
	        'name' => esc_html__('Footer Widget ', 'cargo-and-shipping-company').$cargo_and_shipping_company_count,
	        'id' => 'cargo-and-shipping-company-footer-widget-'.$cargo_and_shipping_company_i,
	        'description' => esc_html__('Add widgets here.', 'cargo-and-shipping-company'),
	        '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', 'cargo_and_shipping_company_widgets_init');