<?php
/*******************************************************************
* These are settings for the Theme Customizer in the admin panel. 
*******************************************************************/
if ( ! function_exists( 'thefashblog_theme_customizer' ) ) :
  function thefashblog_theme_customizer( $wp_customize ) {
    
  
    /* color scheme option */

    $wp_customize->add_setting( 'thefashblog_color_settings', array (
      'default' => '#ffffff',
      'sanitize_callback' => 'sanitize_hex_color',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'thefashblog_color_settings', array(
      'label'    => __( 'Top Text Color', 'the-fash-blog' ),
      'section'  => 'colors',
      'settings' => 'thefashblog_color_settings',
    ) ) );

    $wp_customize->add_setting( 'thefashblog_color_settings1', array (
      'default' => '#000000',
      'sanitize_callback' => 'sanitize_hex_color',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'thefashblog_color_settings1', array(
      'label'    => __( 'Top Background Color', 'the-fash-blog' ),
      'section'  => 'colors',
      'settings' => 'thefashblog_color_settings1',
    ) ) );

    $wp_customize->add_setting( 'thefashblog_color_settings1_2', array (
      'default' => '#ffffff',
      'sanitize_callback' => 'sanitize_hex_color',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'thefashblog_color_settings1_2', array(
      'label'    => __( 'Footer Text Color', 'the-fash-blog' ),
      'section'  => 'colors',
      'settings' => 'thefashblog_color_settings1_2',
    ) ) );

    $wp_customize->add_setting( 'thefashblog_color_settings1_3', array (
      'default' => '#000000',
      'sanitize_callback' => 'sanitize_hex_color',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'thefashblog_color_settings1_3', array(
      'label'    => __( 'Footer Background Color', 'the-fash-blog' ),
      'section'  => 'colors',
      'settings' => 'thefashblog_color_settings1_3',
    ) ) );



    $wp_customize->add_setting( 'thefashblog_color_settings_1', array (
      'default' => '#000000',
      'sanitize_callback' => 'sanitize_hex_color',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'thefashblog_color_settings_1', array(
      'label'    => __( 'Primary Color Scheme', 'the-fash-blog' ),
      'section'  => 'colors',
      'settings' => 'thefashblog_color_settings_1',
    ) ) );


    $wp_customize->add_setting( 'thefashblog_color_settings_2', array (
      'default' => '#ef2673',
      'sanitize_callback' => 'sanitize_hex_color',
    ) );

    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'thefashblog_color_settings_2', array(
      'label'    => __( 'Secondary Color Scheme', 'the-fash-blog' ),
      'section'  => 'colors',
      'settings' => 'thefashblog_color_settings_2',
    ) ) );

    
    /* social media option */
    $wp_customize->add_section( 'thefashblog_social_section' , array(
      'title'       => __( 'Social Media Icons', 'the-fash-blog' ),
      'priority'    => 32,
      'description' => __( 'Optional media icons in the header', 'the-fash-blog' ),
    ) );
    
    $wp_customize->add_setting( 'thefashblog_facebook', array (
      'sanitize_callback' => 'esc_url_raw',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'thefashblog_facebook', array(
      'label'    => __( 'Enter your Facebook url', 'the-fash-blog' ),
      'section'  => 'thefashblog_social_section',
      'settings' => 'thefashblog_facebook',
      'priority'    => 101,
    ) ) );
  
    $wp_customize->add_setting( 'thefashblog_twitter', array (
      'sanitize_callback' => 'esc_url_raw',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'thefashblog_twitter', array(
      'label'    => __( 'Enter your Twitter url', 'the-fash-blog' ),
      'section'  => 'thefashblog_social_section',
      'settings' => 'thefashblog_twitter',
      'priority'    => 102,
    ) ) );
    
    $wp_customize->add_setting( 'thefashblog_google', array (
      'sanitize_callback' => 'esc_url_raw',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'thefashblog_google', array(
      'label'    => __( 'Enter your Google+ url', 'the-fash-blog' ),
      'section'  => 'thefashblog_social_section',
      'settings' => 'thefashblog_google',
      'priority'    => 103,
    ) ) );
    
    $wp_customize->add_setting( 'thefashblog_pinterest', array (
      'sanitize_callback' => 'esc_url_raw',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'thefashblog_pinterest', array(
      'label'    => __( 'Enter your Pinterest url', 'the-fash-blog' ),
      'section'  => 'thefashblog_social_section',
      'settings' => 'thefashblog_pinterest',
      'priority'    => 104,
    ) ) );
    
    $wp_customize->add_setting( 'thefashblog_linkedin', array (
      'sanitize_callback' => 'esc_url_raw',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'thefashblog_linkedin', array(
      'label'    => __( 'Enter your Linkedin url', 'the-fash-blog' ),
      'section'  => 'thefashblog_social_section',
      'settings' => 'thefashblog_linkedin',
      'priority'    => 105,
    ) ) );
    
    $wp_customize->add_setting( 'thefashblog_youtube', array (
      'sanitize_callback' => 'esc_url_raw',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'thefashblog_youtube', array(
      'label'    => __( 'Enter your Youtube url', 'the-fash-blog' ),
      'section'  => 'thefashblog_social_section',
      'settings' => 'thefashblog_youtube',
      'priority'    => 106,
    ) ) );
    
    $wp_customize->add_setting( 'thefashblog_tumblr', array (
      'sanitize_callback' => 'esc_url_raw',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'thefashblog_tumblr', array(
      'label'    => __( 'Enter your Tumblr url', 'the-fash-blog' ),
      'section'  => 'thefashblog_social_section',
      'settings' => 'thefashblog_tumblr',
      'priority'    => 107,
    ) ) );
    
    $wp_customize->add_setting( 'thefashblog_instagram', array (
      'sanitize_callback' => 'esc_url_raw',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'thefashblog_instagram', array(
      'label'    => __( 'Enter your Instagram url', 'the-fash-blog' ),
      'section'  => 'thefashblog_social_section',
      'settings' => 'thefashblog_instagram',
      'priority'    => 108,
    ) ) );
    
    $wp_customize->add_setting( 'thefashblog_flickr', array (
      'sanitize_callback' => 'esc_url_raw',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'thefashblog_flickr', array(
      'label'    => __( 'Enter your Flickr url', 'the-fash-blog' ),
      'section'  => 'thefashblog_social_section',
      'settings' => 'thefashblog_flickr',
      'priority'    => 109,
    ) ) );
    
    $wp_customize->add_setting( 'thefashblog_vimeo', array (
      'sanitize_callback' => 'esc_url_raw',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'thefashblog_vimeo', array(
      'label'    => __( 'Enter your Vimeo url', 'the-fash-blog' ),
      'section'  => 'thefashblog_social_section',
      'settings' => 'thefashblog_vimeo',
      'priority'    => 110,
    ) ) );
    
    $wp_customize->add_setting( 'thefashblog_rss', array (
      'sanitize_callback' => 'esc_url_raw',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'thefashblog_rss', array(
      'label'    => __( 'Enter your RSS url', 'the-fash-blog' ),
      'section'  => 'thefashblog_social_section',
      'settings' => 'thefashblog_rss',
      'priority'    => 112,
    ) ) );
    
    $wp_customize->add_setting( 'thefashblog_email', array (
      'sanitize_callback' => 'sanitize_email',
    ) );
    
    $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'thefashblog_email', array(
      'label'    => __( 'Enter your email address', 'the-fash-blog' ),
      'section'  => 'thefashblog_social_section',
      'settings' => 'thefashblog_email',
      'priority'    => 113,
    ) ) );

     /* author bio in posts option */
    $wp_customize->add_section( 'thefashblog_slider_section' , array(
      'title'       => __( 'Display Homepage Slider', 'the-fash-blog' ),
      'priority'    => 33,
      'description' => __( 'Option to Display Homepage Slider', 'the-fash-blog' ),
    ) );
    
    $wp_customize->add_setting( 'thefashblog_slider', array (
      'default' => true,
      'sanitize_callback' => 'thefashblog_sanitize_checkbox',
    ) );
    
    $wp_customize->add_control('slider', array(
      'settings' => 'thefashblog_slider',
      'label' => __('Display Homepage Slider', 'the-fash-blog'),
      'section' => 'thefashblog_slider_section',
      'type' => 'checkbox',
    ));
    

     /* author bio in posts option */
    $wp_customize->add_section( 'thefashblog_author_bio_section' , array(
      'title'       => __( 'Display Author Bio', 'the-fash-blog' ),
      'priority'    => 35,
      'description' => __( 'Option to disable the author bio in the posts.', 'the-fash-blog' ),
    ) );
    
    $wp_customize->add_setting( 'thefashblog_author_bio', array (
      'default' => true,
      'sanitize_callback' => 'thefashblog_sanitize_checkbox',
    ) );
    
    $wp_customize->add_control('author_bio', array(
      'settings' => 'thefashblog_author_bio',
      'label' => __('Display Author Bio', 'the-fash-blog'),
      'section' => 'thefashblog_author_bio_section',
      'type' => 'checkbox',
    ));
  
  }
endif;
add_action('customize_register', 'thefashblog_theme_customizer');


/**
 * Sanitize checkbox
 */
if ( ! function_exists( 'thefashblog_sanitize_checkbox' ) ) :
  function thefashblog_sanitize_checkbox( $input ) {
    if ( $input == 1 ) {
      return 1;
    } else {
      return '';
    }
  }
endif;