<?php
/**
* Widget Functions.
*
* @package Multi Sports Club
*/

function multi_sports_club_widgets_init(){

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

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

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


    $multi_sports_club_default = multi_sports_club_get_default_theme_options();
    $multi_sports_club_multi_sports_club_footer_column_layout = absint( get_theme_mod( 'multi_sports_club_footer_column_layout',$multi_sports_club_default['multi_sports_club_footer_column_layout'] ) );

    for( $i = 0; $i < $multi_sports_club_multi_sports_club_footer_column_layout; $i++ ){
    	
    	if( $i == 0 ){ $count = esc_html__('One','multi-sports-club'); }
    	if( $i == 1 ){ $count = esc_html__('Two','multi-sports-club'); }
    	if( $i == 2 ){ $count = esc_html__('Three','multi-sports-club'); }

	    register_sidebar( array(
	        'name' => esc_html__('Footer Widget ', 'multi-sports-club').$count,
	        'id' => 'multi-sports-club-footer-widget-'.$i,
	        'description' => esc_html__('Add widgets here.', 'multi-sports-club'),
	        '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', 'multi_sports_club_widgets_init');