<?php

if ( ! function_exists( 'calla_elated_register_sidebars' ) ) {
	/**
	 * Function that registers theme's sidebars
	 */
	function calla_elated_register_sidebars() {
		
		register_sidebar(
			array(
				'id'            => 'sidebar',
				'name'          => esc_html__( 'Sidebar', 'calla' ),
				'description'   => esc_html__( 'Default Sidebar', 'calla' ),
				'before_widget' => '<div id="%1$s" class="widget %2$s">',
				'after_widget'  => '</div>',
				'before_title'  => '<div class="eltdf-widget-title-holder"><h6 class="eltdf-widget-title">',
				'after_title'   => '</h6></div>'
			)
		);
	}
	
	add_action( 'widgets_init', 'calla_elated_register_sidebars', 1 );
}

if ( ! function_exists( 'calla_elated_add_support_custom_sidebar' ) ) {
	/**
	 * Function that adds theme support for custom sidebars. It also creates CallaElatedSidebar object
	 */
	function calla_elated_add_support_custom_sidebar() {
		add_theme_support( 'CallaElatedSidebar' );
		
		if ( get_theme_support( 'CallaElatedSidebar' ) ) {
			new CallaElatedSidebar();
		}
	}
	
	add_action( 'after_setup_theme', 'calla_elated_add_support_custom_sidebar' );
}