<?php
/**
 * Excel Blog Widgets
 *
 * @package Excel_Blog
 */

/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
function excel_blog_widgets_init() {
	
    $sidebars = array(
        'sidebar'   => array(
            'name'        => __( 'Sidebar', 'excel-blog' ),
            'id'          => 'sidebar', 
            'description' => __( 'Add widgets here.', 'excel-blog' ),
        ),
        'footer-one'=> array(
            'name'        => __( 'Footer One', 'excel-blog' ),
            'id'          => 'footer-one', 
            'description' => __( 'Add footer one widgets here.', 'excel-blog' ),
        ),
        'footer-two'=> array(
            'name'        => __( 'Footer Two', 'excel-blog' ),
            'id'          => 'footer-two', 
            'description' => __( 'Add footer two widgets here.', 'excel-blog' ),
        ),
        'footer-three'=> array(
            'name'        => __( 'Footer Three', 'excel-blog' ),
            'id'          => 'footer-three', 
            'description' => __( 'Add footer three widgets here.', 'excel-blog' ),
        )
    );
    
    foreach( $sidebars as $sidebar ){
        register_sidebar( array(
    		'name'          => esc_html( $sidebar['name'] ),
    		'id'            => esc_attr( $sidebar['id'] ),
    		'description'   => esc_html( $sidebar['description'] ),
    		'before_widget' => '<section id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</section>',
    		'before_title'  => '<h2 class="widget-title">',
    		'after_title'   => '</h2>',
    	) );
    }
    
}
add_action( 'widgets_init', 'excel_blog_widgets_init' );

/**
 * Load widget featured post.
 */
require get_template_directory() . '/inc/widgets/widget-featured-post.php';

/**
 * Load widget popular post.
 */
require get_template_directory() . '/inc/widgets/widget-popular-posts.php';

/**
 * Load widget recent post.
 */
require get_template_directory() . '/inc/widgets/widget-recent-posts.php';

/**
 * Load widget social link.
 */
require get_template_directory() . '/inc/widgets/widget-social-links.php';