<?php if( ! defined( 'ABSPATH' ) ) exit;
	function faster_social_section () { ?>
			<div <?php if(get_theme_mod( 'social_media_activate' )){ ?> style="float: none;"<?php } ?> class="seos-fa-icons">
				<?php if (get_theme_mod( 'faster_facebook' )) : ?>
					<a target="<?php if(esc_attr(get_theme_mod( 'facebook_link' )) == "new"){ echo "_blank"; } else {echo "_self"; } ?>" href="<?php echo esc_url(get_theme_mod( 'faster_facebook' )); ?>"><i class="fa fa-facebook-f"></i></a>
				<?php endif; ?>
				<?php if (get_theme_mod( 'faster_twitter' )) : ?>
					<a target="<?php if(esc_attr(get_theme_mod( 'twitter_link' )) == "new"){ echo "_blank"; } else {echo "_self"; } ?>" href="<?php echo esc_url(get_theme_mod( 'faster_twitter' )); ?>"><i class="fa fa-twitter"></i></a>
				<?php endif; ?>
				<?php if (get_theme_mod( 'faster_pinterest' )) : ?>
					<a target="<?php if(esc_attr(get_theme_mod( 'pinterest_link' )) == "new"){ echo "_blank"; } else {echo "_self"; } ?>" href="<?php echo esc_url(get_theme_mod( 'faster_pinterest' )); ?>"><i class="fa fa-pinterest"></i></a>
				<?php endif; ?>	
				
			</div>
<?php } 
add_action( 'customize_register', 'faster__social' );
function faster__social( $wp_customize ) {
	function faster_header_social_links( $input ) {
		$valid = array(
				'new' => esc_attr__( 'Open in a new window.', 'faster' ),
				'' => esc_attr__( 'Open in the same window.', 'faster' ),
		);
		if ( array_key_exists( $input, $valid ) ) {
			return $input;
		} else {
			return '';
		}
	}	
 		$wp_customize->add_section( 'faster_social_section' , array(
			'title'       => __( 'Social Icons', 'faster' ),
			'description' => __( 'Social Media Icons.', 'faster' ),
			'priority'    => 2,	
			//'description' => __( 'Social media buttons', 'faster' ),
		) ); 
 		$wp_customize->add_setting( 'faster_active_social', array (
			'sanitize_callback' => 'faster_sanitize_checkbox',
		) );
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'faster_active_social', array(
			'label'    => __( 'Activate Social Icons Header', 'faster' ),
			'section'  => 'faster_social_section',
			'settings' => 'faster_active_social',
			'type' => 'checkbox'
		) ) );
		$wp_customize->add_setting( 'faster_facebook', array (
			'sanitize_callback' => 'esc_url_raw',
		) );
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'faster_facebook', array(
			'label'    => __( 'Enter Facebook url', 'faster' ),		
			'section'  => 'faster_social_section',
			'settings' => 'faster_facebook',
		) ) );
 		$wp_customize->add_setting( 'facebook_link', array (
			'sanitize_callback' => 'faster_header_social_links',
		) );
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'facebook_link', array(
			'description'    => __( 'Open Facebook Link', 'faster' ),
			'section'  => 'faster_social_section',		
			'settings' => 'facebook_link',
			'type'     =>  'select',	
            'choices'  => array(
				'new' => esc_attr__( 'Open in a new window.', 'faster' ),
				'' => esc_attr__( 'Open in the same window.', 'faster' ),
            )
		) ) );		
		$wp_customize->add_setting( 'faster_twitter', array (
			'sanitize_callback' => 'esc_url_raw',
		) );
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'faster_twitter', array(
			'label'    => __( 'Enter Twitter url', 'faster' ),		
			'section'  => 'faster_social_section',
			'settings' => 'faster_twitter',
		) ) );	
 		$wp_customize->add_setting( 'twitter_link', array (
			'sanitize_callback' => 'faster_header_social_links',
		) );
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'twitter_link', array(
			'description'    => __( 'Open Twitter Link', 'faster' ),
			'section'  => 'faster_social_section',		
			'settings' => 'twitter_link',
			'type'     =>  'select',	
            'choices'  => array(
				'new' => esc_attr__( 'Open in a new window.', 'faster' ),
				'' => esc_attr__( 'Open in the same window.', 'faster' ),
            )
		) ) );		
		$wp_customize->add_setting( 'faster_pinterest', array (
			'sanitize_callback' => 'esc_url_raw',
		) );
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'faster_pinterest', array(
			'label'    => __( 'Enter Pinterest url', 'faster' ),		
			'section'  => 'faster_social_section',
			'settings' => 'faster_pinterest',
		) ) );	
 		$wp_customize->add_setting( 'pinterest_link', array (
			'sanitize_callback' => 'faster_header_social_links',
		) );
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'pinterest_link', array(
			'description'    => __( 'Open Pinterest Link', 'faster' ),
			'section'  => 'faster_social_section',		
			'settings' => 'pinterest_link',
			'type'     =>  'select',	
            'choices'  => array(
				'new' => esc_attr__( 'Open in a new window.', 'faster' ),
				'' => esc_attr__( 'Open in the same window.', 'faster' ),
            )
		) ) );	
}
/********************************************
* Social styles
*********************************************/ 	
function faster_social_method() {
        $social_media_color_mod = esc_attr(get_theme_mod( 'social_media_color' ));
        $social_media_hover_color_mod = esc_attr(get_theme_mod( 'social_media_hover_color' ));
		if($social_media_color_mod) { $social_media_color = ".social .fa-icons i, .social-top .fa {color: {$social_media_color_mod} !important;}";} else {$social_media_color ="";}
		if($social_media_hover_color_mod) { $social_media_hover_color = ".social .fa-icons i:hover, .social-top a:hover .fa {color: {$social_media_hover_color_mod} !important;}";} else {$social_media_hover_color ="";}
        wp_add_inline_style( 'faster-style-css', 
		$social_media_color.$social_media_hover_color);
}
add_action( 'wp_enqueue_scripts', 'faster_social_method' );				