<?php
/**
 * abblog Theme Customizer
 *
 * @package abblog
 */

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function abblog_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' => 'abblog_customize_partial_blogname',
			)
		);
		$wp_customize->selective_refresh->add_partial(
			'blogdescription',
			array(
				'selector'        => '.site-description',
				'render_callback' => 'abblog_customize_partial_blogdescription',
			)
		);
	}
	
	
	$wp_customize->add_section(
		'header_area',
		array(
			'title'    => __( 'Header Settings', 'abblog' ),
			'priority' => 40,
		)
	);

	
	$wp_customize->add_setting(
		'header_title',
		array(
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'header_title',
		array(
			'type'        => 'text',
			'label'       => __( 'Enter Main Title:', 'abblog' ),
			'description' => __( 'Leave this setting blank to disable it.', 'abblog' ),
			'section'     => 'header_area',
		)
	);

	$wp_customize->add_setting(
		'header_sub_title',
		array(
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'header_sub_title',
		array(
			'type'        => 'text',
			'label'       => __( 'Enter Sub Title:', 'abblog' ),
			'description' => __( 'Leave this setting blank to disable it.', 'abblog' ),
			'section'     => 'header_area',
		)
	);

	$wp_customize->add_section(
		'service_section',
		array(
			'title' => __( 'Service Section', 'abblog' ),
		)
	);

	
	
	$wp_customize->add_setting(
		'service_t_one',
		array(
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'service_t_one',
		array(
			'type'        => 'text',
			'label'       => __( 'Enter Title 1:', 'abblog' ),
			'description' => __( 'Leave blank to disable it.', 'abblog' ),
			'section'     => 'service_section',
		)
	);
	$wp_customize->add_setting(
		'service_d_one',
		array(
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'service_d_one',
		array(
			'type'        => 'text',
			'label'       => __( 'Enter Description 1:', 'abblog' ),
			'description' => __( 'Leave blank to disable it.', 'abblog' ),
			'section'     => 'service_section',
		)
	);
	
	
	
	
	
	
	
	$wp_customize->add_setting(
		'service_t_two',
		array(
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'service_t_two',
		array(
			'type'        => 'text',
			'label'       => __( 'Enter Title 2:', 'abblog' ),
			'description' => __( 'Leave blank to disable it.', 'abblog' ),
			'section'     => 'service_section',
		)
	);
	$wp_customize->add_setting(
		'service_d_two',
		array(
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'service_d_two',
		array(
			'type'        => 'text',
			'label'       => __( 'Enter Description 2:', 'abblog' ),
			'description' => __( 'Leave blank to disable it.', 'abblog' ),
			'section'     => 'service_section',
		)
	);
	
	
	
	
	
	$wp_customize->add_setting(
		'service_t_three',
		array(
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'service_t_three',
		array(
			'type'        => 'text',
			'label'       => __( 'Enter Title 3:', 'abblog' ),
			'description' => __( 'Leave blank to disable it.', 'abblog' ),
			'section'     => 'service_section',
		)
	);
	$wp_customize->add_setting(
		'service_d_three',
		array(
			'sanitize_callback' => 'sanitize_text_field',
		)
	);

	$wp_customize->add_control(
		'service_d_three',
		array(
			'type'        => 'text',
			'label'       => __( 'Enter Description 3:', 'abblog' ),
			'description' => __( 'Leave blank to disable it.', 'abblog' ),
			'section'     => 'service_section',
		)
	);
	
	
	
	
	
	
	
	
	
	
}
add_action( 'customize_register', 'abblog_customize_register' );

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

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

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


