<?php
/**
* Widget Functions.
*
* @package Board Games
*/

function board_games_widgets_init(){

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


    $board_games_default = board_games_get_default_theme_options();
    $board_games_footer_column_layout = absint( get_theme_mod( 'board_games_footer_column_layout',$board_games_default['board_games_footer_column_layout'] ) );

    for( $board_games_i = 0; $board_games_i < $board_games_footer_column_layout; $board_games_i++ ){
    	
    	if( $board_games_i == 0 ){ $board_games_count = esc_html__('One','board-games'); }
    	if( $board_games_i == 1 ){ $board_games_count = esc_html__('Two','board-games'); }
    	if( $board_games_i == 2 ){ $board_games_count = esc_html__('Three','board-games'); }

	    register_sidebar( array(
	        'name' => esc_html__('Footer Widget ', 'board-games').$board_games_count,
	        'id' => 'board-games-footer-widget-'.$board_games_i,
	        'description' => esc_html__('Add widgets here.', 'board-games'),
	        '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', 'board_games_widgets_init');