<?php if( ! defined( 'ABSPATH' ) ) exit;
function baw_customize_register_footer( $wp_customize ) {

 
		$wp_customize->add_section( 'baw_footer' , array(
			'title'       => __( 'Footer Options', 'baw' ),
			'priority'       => 94,
		) );

 		$wp_customize->add_setting( 'baw_copyright', array (
			'sanitize_callback' => 'baw_sanitize_checkbox',
		) );
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'baw_copyright', array(
			'label'    => __( 'Activate Custom Copyright', 'baw' ),
			'section'  => 'baw_footer',
			'type' => 'checkbox',
		) ) );

		$wp_customize->add_setting( 'baw_read_more_setting', array (
			'sanitize_callback' => 'sanitize_text_field',
		) );
			
		$wp_customize->add_setting( 'code_copyright_text', array (
			'sanitize_callback' => 'wp_kses_post',
			'default'     => '',
		) );
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'code_copyright_text', array(
			'label'    => __( 'Add Copyright', 'baw' ),
			'section'  => 'baw_footer',
			'type' => 'textarea',
		) ) );

   	    $wp_customize->add_setting( 'baw_footer_background', array (
			'sanitize_callback' => 'sanitize_hex_color',
			'default'     => '',
		) );
		
 		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'baw_footer_background', array(
			'label'    => __( 'Background Color', 'baw' ),
			'section'  => 'baw_footer',
		) ) );
		
   	    $wp_customize->add_setting( 'baw_footer_title', array (
			'sanitize_callback' => 'sanitize_hex_color',
			'default'     => '',
		) );
		
 		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'baw_footer_title', array(
			'label'    => __( 'Title Color', 'baw' ),
			'section'  => 'baw_footer',
		) ) );

   	    $wp_customize->add_setting( 'baw_footer_text', array (
			'sanitize_callback' => 'sanitize_hex_color',
			'default'     => '',
		) );
		
 		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'baw_footer_text', array(
			'label'    => __( 'Text Color', 'baw' ),
			'section'  => 'baw_footer',
		) ) );

   	    $wp_customize->add_setting( 'baw_footer_link_hover', array (
			'sanitize_callback' => 'sanitize_hex_color',
			'default'     => '',
		) );
		
 		$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'baw_footer_link_hover', array(
			'label'    => __( 'Link Hover Color', 'baw' ),
			'section'  => 'baw_footer',
		) ) );
		
		
}
add_action( 'customize_register', 'baw_customize_register_footer' );



/**
 * Footer styles
 */ 	

function baw_footer_method() {

        $baw_footer_background = get_theme_mod( 'baw_footer_background' );
        $baw_footer_title = get_theme_mod( 'baw_footer_title' );
        $baw_footer_text = get_theme_mod( 'baw_footer_text' );
        $baw_footer_link_hover = get_theme_mod( 'baw_footer_link_hover' );

		
		if($baw_footer_background) { $style1 = ".footer-center, .site-info {background: {$baw_footer_background} !important;}";} else {$style1 ="";}
		if($baw_footer_title) { $style2 = ".footer-widgets h2 {color: {$baw_footer_title} !important;}";} else {$style2 ="";}
		if($baw_footer_text) { $style3 = ".footer-widgets a, .footer-widgets, .site-info,  .site-info a {color: {$baw_footer_text} !important;}";} else {$style3 ="";}
		if($baw_footer_link_hover) { $style4 = ".footer-widgets a:hover, .site-info a:hover {color: {$baw_footer_link_hover} !important;}";} else {$style4 ="";}

        wp_add_inline_style( 'black-and-white-style',
		$style1.$style2.$style3.$style4
		);
}
add_action( 'wp_enqueue_scripts', 'baw_footer_method' );		
		