<?php
/**
 * eco-solar-energy Theme Customizer
 *
 * @package eco-solar-energy
 */

  // Custom Controls.
require get_template_directory() . '/inc/custom-control/custom-control.php';

// Sanitize callback.
require get_template_directory() . '/inc/customizer/sanitize-callback.php';

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function eco_solar_energy_customize_register( $wp_customize ) {
	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';

	if ( isset( $wp_customize->selective_refresh ) ) {
		$wp_customize->selective_refresh->add_partial(
			'blogname',
			array(
				'selector'        => '.site-title a',
				'render_callback' => 'eco_solar_energy_customize_partial_blogname',
			)
		);
		$wp_customize->selective_refresh->add_partial(
			'blogdescription',
			array(
				'selector'        => '.site-description',
				'render_callback' => 'eco_solar_energy_customize_partial_blogdescription',
			)
		);
	}
	
	// Front Page Link
	require get_template_directory() . '/inc/customizer/front-options.php';

	// Theme Page Link
	require get_template_directory() . '/inc/customizer/theme-options.php';
}
add_action( 'customize_register', 'eco_solar_energy_customize_register' );

/**
 * Render the site title for the selective refresh partial.
 *
 * @return void
 */
function eco_solar_energy_customize_partial_blogname() {
	bloginfo( 'name' );
}

/**
 * Render the site tagline for the selective refresh partial.
 *
 * @return void
 */
function eco_solar_energy_customize_partial_blogdescription() {
	bloginfo( 'description' );
}

/**
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
 */
function eco_solar_energy_customize_preview_js() {
	wp_enqueue_script( 'eco_solar_energy-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), ECO_SOLAR_ENERGY_S_VERSION, true );
}
add_action( 'customize_preview_init', 'eco_solar_energy_customize_preview_js' );


function eco_solar_energy_customize_css()
{
?>
	<style type="text/css">
		.headericondiv .social-links svg{
			color: <?php echo esc_html(get_theme_mod('social_icons_color')); ?>;
		}
		.site-header .contact-info a{
			color: <?php echo esc_html(get_theme_mod('info_text_color')); ?>;
		}
		.site-header .contact-info .phone_call a .icon{
			color: <?php echo esc_html(get_theme_mod('info_callicon_color')); ?>;
		}
		.site-header .contact-info .email_info a .icon{
			color: <?php echo esc_html(get_theme_mod('info_emailicon_color')); ?>;
		}
		.widget .widget-title, .widget .wp-block-heading, .widget .wp-block-search__label{
			background: <?php echo esc_html(get_theme_mod('sidebar_heading_bg_color')); ?>;
		}
		.widget .widget-title, .widget .wp-block-heading, .widget .wp-block-search__label{
			color: <?php echo esc_html(get_theme_mod('sidebar_heading_text_color')); ?>;
		}
		.widget.widget_search .wp-block-search__inside-wrapper .wp-block-search__button{
			color: <?php echo esc_html(get_theme_mod('sidebar_searchbtn_text_color')); ?>;
		}
		.main-navigation ul li a{
			color: <?php echo esc_html(get_theme_mod('menu_text_color')); ?>;
		}
		.widget.widget_search .wp-block-search__inside-wrapper .wp-block-search__button{
			background-color: <?php echo esc_html(get_theme_mod('sidebar_searchbtn_bg_color')); ?>;
		}
		.widget ul:not(.magazine-tabs) li::before, .widget ul:not(.magazine-tabs) li::after{
			border: 2px solid <?php echo esc_html(get_theme_mod('sidebar_texticon_color')); ?>;
		}
		.widget ul:not(.magazine-tabs) li:hover{
			border-left: 7px solid <?php echo esc_html(get_theme_mod('sidebar_textleftborder_color')); ?>;
		}
		.entry-date a{
			background-color: <?php echo esc_html(get_theme_mod('post_date_bg_color')); ?>;
		}

		/* ---------------## Slider Section Color Start ##------------- */
		.home-section .read-more .btn{
			background: <?php echo esc_html(get_theme_mod('eco_solar_energy_slider_buttonbackground1_color')); ?>;
		}
		.home-section .read-more .btn{
			color: <?php echo esc_html(get_theme_mod('eco_solar_energy_slider_buttontext1_color')); ?>;
		}
		.site-header{
			background: <?php echo esc_html(get_theme_mod('eco_solar_energy_headerbg_color')); ?>
		}
		.navbar{
			background-color: <?php echo esc_html(get_theme_mod('eco_solar_energy_menuheaderbg_color')); ?>
		}
		

		
	</style>
	
<?php
}
add_action('wp_head', 'eco_solar_energy_customize_css');
