<?php
/**
 * Site Title Setting
 *
 * @package Feminine_Lifestyle_Blog
 */

function feminine_lifestyle_blog_customize_register( $wp_customize ) {
	
    $wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
    $wp_customize->get_setting( 'background_color' )->transport = 'postMessage';
    $wp_customize->get_setting( 'background_image' )->transport = 'refresh';
    $wp_customize->get_control( 'site_icon' )->priority = 30;
	
	if( isset( $wp_customize->selective_refresh ) ){
		$wp_customize->selective_refresh->add_partial( 'blogname', array(
			'selector'        => '.site-title a',
			'render_callback' => 'feminine_lifestyle_blog_customize_partial_blogname',
		) );
		$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
			'selector'        => '.site-description',
			'render_callback' => 'feminine_lifestyle_blog_customize_partial_blogdescription',
		) );
	}

        /** Body Font Size */
        $wp_customize->add_setting(
        'site_logo_size',
        array(
            'capability'        => 'edit_theme_options',
            'sanitize_callback' => 'feminine_lifestyle_blog_sanitize_number_absint',
            'default'           => 200,
            'transport'         => 'postMessage',
        )
    );
    
    $wp_customize->add_control(
        new Feminine_Lifestyle_Blog_Slider_Control( 
            $wp_customize,
            'site_logo_size',
            array(
                'label'   => __( 'Set the width(px) of your Site Logo', 'feminine-lifestyle-blog' ),
                'section' => 'title_tagline',
                'choices' => array(
                    'min'  => 10,
                    'max'  => 300,
                    'step' => 1,
                ),
                'priority' => 50
            )
        )
    );
    
    /** Site Title Color*/
    $wp_customize->add_setting( 
        'site_title_color', 
        array(
            'default'           => '#222222',
            'sanitize_callback' => 'sanitize_hex_color',
            'transport'         => 'postMessage'
        ) 
    );

    $wp_customize->add_control( 
        new WP_Customize_Color_Control( 
            $wp_customize, 
            'site_title_color', 
            array(
                'label'       => __( 'Site Title Color', 'feminine-lifestyle-blog' ),
                'description' => __( 'Site Title color of the theme.', 'feminine-lifestyle-blog' ),
                'section'     => 'title_tagline',
                'priority'    => 66,
            )
        )
    );
    
}
add_action( 'customize_register', 'feminine_lifestyle_blog_customize_register' );