<?php
/**
* Widget Functions.
*
* @package OTT Vlogger
*/

function ott_vlogger_widgets_init(){

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


    $ott_vlogger_default = ott_vlogger_get_default_theme_options();
    $ott_vlogger_ott_vlogger_footer_column_layout = absint( get_theme_mod( 'ott_vlogger_footer_column_layout',$ott_vlogger_default['ott_vlogger_footer_column_layout'] ) );

    for( $i = 0; $i < $ott_vlogger_ott_vlogger_footer_column_layout; $i++ ){
    	
    	if( $i == 0 ){ $count = esc_html__('One','ott-vlogger'); }
    	if( $i == 1 ){ $count = esc_html__('Two','ott-vlogger'); }
    	if( $i == 2 ){ $count = esc_html__('Three','ott-vlogger'); }

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