<?php
/**
 * Mina Theme Customizer.
 *
 * @package Mina
 */

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function mina_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';
}
add_action( 'customize_register', 'mina_customize_register' );

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


/******************** Mina Custom JS ******************************************/		
		
	if ( ! function_exists( 'mina_js' ) ) :
	function mina_js( $wp_customize ) {	
	
	$wp_customize->add_section( 'mina_js_section', array(
		'title'       => __( 'Custom JavaScript PRO', 'mina' ),
		'description' => __( '<a target="_blank" href="https://minathemes.com/mina-wordpress-theme/">Preview Pro</a>', 'mina' ),	
		'panel'		=> 'mina_options',			
		'priority'	=> 6,

	));
	$wp_customize->add_setting( 'mina_custom_js_header', array(
		'description' => __( '<a target="_blank" href="https://minathemes.com/mina-wordpress-theme/">Preview Pro</a>', 'mina' ),
		'sanitize_callback' => 'sanitize_text_field',		
		'capability'		=> 'edit_theme_options',
	));
	$wp_customize->add_control( new WP_Customize_Control(
			$wp_customize, 'mina_custom_js_header', array(
				'section'	=> 'mina_js_section',
				'settings'	=> 'mina_custom_js_header',
				'type'		=> 'radio'
			)
		)
	);
	
	}
endif;
		add_action('customize_register', 'mina_js');

/***********************************************************************************
 * Social media option
***********************************************************************************/

if ( ! function_exists( 'mina' ) ) :
	function mina( $wp_customize ) {
 
		$wp_customize->add_section( 'mina_section' , array(
		'title'       => __( 'Social Media PRO', 'mina' ),
		'description' => __( '<a target="_blank" href="https://minathemes.com/mina-wordpress-theme/">Preview Pro</a>', 'mina' ),
		'panel'		=> 'mina_options',		
		'priority'		=> 5,
		) );
		
		$wp_customize->add_setting( 'mina_facebook', array (
		'sanitize_callback' => 'sanitize_text_field'
		) );
		
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'mina_facebook', array(
			'section'  => 'mina_section',
			'settings' => 'mina_facebook',
			'type' => 'radio',
		) ) );

								
	}
endif;
		add_action('customize_register', 'mina');

		
/******************** Mina Top Ads ******************************************/
	
	if ( ! function_exists( 'mina_ads' ) ) :
	function mina_ads( $wp_customize ) {	
	
	$wp_customize->add_section( 'mina_ads_section', array(
		'title'       => __( 'Google Adsense Code PRO', 'mina' ),
			'description' => __( '<a target="_blank" href="https://minathemes.com/mina-wordpress-theme/">Preview Pro</a>', 'mina' ),	
			'panel'		=> 'mina_options',			
		'priority'	=> 6,

	));
	$wp_customize->add_setting( 'mina_custom_ads', array(
		'default'			=> '',
		'capability'		=> 'edit_theme_options',
		'sanitize_callback' => 'sanitize_text_field'
	));
	$wp_customize->add_control(
		new WP_Customize_Control(
			$wp_customize, 'mina_custom_ads', array(
				'label'		=> __( 'JavaScript Adsense Header Code 728x90px', 'mina' ),
				'section'	=> 'mina_ads_section',
				'settings'	=> 'mina_custom_ads',
				'type'		=> 'radio'
			)
		)
	);
	
}	
endif;
		add_action('customize_register', 'mina_ads');

	if ( ! function_exists( 'mina__back_to_top' ) ) :
	function mina__back_to_top( $wp_customize ) {	
	
/********************************************
* Back to Top Button
*********************************************/


		$wp_customize->add_section( 'back_to_top' , array(
		'title'       => __( 'Back To Top PRO', 'mina' ),
			'description' => __( '<a target="_blank" href="https://minathemes.com/mina-wordpress-theme/">Preview Pro</a>', 'mina' ),
			'panel'		=> 'mina_options',			
			'priority'		=> 9,
		) );  
		
		
		$wp_customize->add_setting( 'deactivate_back_to_top', array (
			'sanitize_callback' => 'sanitize_text_field',
			'capability'     => 'edit_theme_options',
		) );

		
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'deactivate_back_to_top', array(
					'label'		=> __( 'Activation.', 'mina' ),
					'section'	=> 'back_to_top',
					'settings'	=> 'deactivate_back_to_top',
					'type'		=> 'radio'

				) 
			) );

			}
			
endif;
		add_action('customize_register', 'mina__back_to_top');