<?php
/**
 * Theme Customizer Controls
 *
 * @package Technical Blogging
 */

if ( ! function_exists( 'technical_blogging_customizer_global_color_setting_register' ) ) :
function technical_blogging_customizer_global_color_setting_register( $wp_customize ) {
 
 	$wp_customize->add_section(
        'technical_blogging_global_color_settings',
        array (
            'priority'      => 40,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Global Color Settings', 'technical-blogging' )
        )
    );

    // Title label
	$wp_customize->add_setting( 
		'technical_blogging_theme_color_settings', 
		array(
		    'sanitize_callback' => 'technical_blogging_sanitize_title',
		) 
	);

	$wp_customize->add_control( 
		new Technical_Blogging_Title_Info_Control( $wp_customize, 'technical_blogging_theme_color_settings', 
		array(
		    'label'       => esc_html__( 'Global Color Settings', 'technical-blogging' ),
		    'section'     => 'technical_blogging_global_color_settings',
		    'type'        => 'technical-blogging-title',
		    'settings'    => 'technical_blogging_theme_color_settings',
		) 
	));

	$wp_customize->add_setting('technical_blogging_global_color1',
        array(
            'type' => 'theme_mod',
            'default'           => '#E32988',
            'sanitize_callback' => 'sanitize_hex_color'
        )
    );

    $wp_customize->add_control(
        new WP_Customize_Color_Control(
            $wp_customize,
            'technical_blogging_global_color1',
            array(
                'label'      => esc_html__( 'Global Color1', 'technical-blogging' ),
                'section'    => 'technical_blogging_global_color_settings',
                'settings'   => 'technical_blogging_global_color1',
            )
        )
    ); 

    $wp_customize->add_setting('technical_blogging_global_color2',
        array(
            'type' => 'theme_mod',
            'default'           => '#313349',
            'sanitize_callback' => 'sanitize_hex_color'
        )
    );

    $wp_customize->add_control(
        new WP_Customize_Color_Control(
            $wp_customize,
            'technical_blogging_global_color2',
            array(
                'label'      => esc_html__( 'Global Color2', 'technical-blogging' ),
                'section'    => 'technical_blogging_global_color_settings',
                'settings'   => 'technical_blogging_global_color2',
            )
        )
    );   

}
endif;

add_action( 'customize_register', 'technical_blogging_customizer_global_color_setting_register' );