<?php

/**
 * Social_Charity Frontpage Settings panel at Theme Customizer
 *
 * @package Social_Charity
 * @since 1.0.0
 */
add_action( 'customize_register', 'social_charity_frontpage_settings_register' );

function social_charity_frontpage_settings_register( $wp_customize ) {
 require get_template_directory() .'/inc/repeater/class-repeater-settings.php';
 require get_template_directory() .'/inc/repeater/class-control-repeater.php';
/**
 * Add Frontpage Settings Panel
 *
 * @since 1.0.0
 */
$wp_customize->add_panel(
  'social_charity_frontpage_settings_panel',
  array(
    'priority'       => 15,
    'capability'     => 'edit_theme_options',
    'theme_supports' => '',
    'title'          => __( 'Frontpage Settings', 'social-charity' ),
  )
);

/*----------------------------------------------------------------------------------------------------------------------------------------*/
/**
 * Front page slider section
 *
 * @since 1.0.0
 */

$wp_customize->add_section(
  'social_charity_frontpage_slider_section',
  array(
   'priority'       => 1,
   'panel'          => 'social_charity_frontpage_settings_panel',
   'capability'     => 'edit_theme_options',
   'theme_supports' => '',
   'title'          => __( 'Slider Section', 'social-charity' ),
   'description'    => __( 'Managed the slider display at Frontpage section.', 'social-charity' ),
 )
);

/**
 * Enable/Disable for  Slider
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
  'social_charity_slider_enable',
  array(
    'default'           => 0,
    'sanitize_callback' => 'social_charity_sanitize_checkbox',
  )
);

$wp_customize->add_control(
  'social_charity_slider_enable',
  array(
    'section'     => 'social_charity_frontpage_slider_section',
    'label'       => __( 'Enable/Disable for  Slider', 'social-charity' ),
    'type'        => 'checkbox'
  )       
);

/*
* Banner slider section
*/
for ($i=1;$i<=4;$i++) {
// Select Page For Slider title with featured image.
  $wp_customize->add_setting( 'social_charity_slider_title_'.$i, array(
    'capability'            => 'edit_theme_options',
    'default'               => '',
    'sanitize_callback'     => 'social_charity_sanitize_dropdown_pages'
  ) );

  $wp_customize->add_control('social_charity_slider_title_'.$i,
    array(
      /* translators: %s: Slider Number. */
      'label'                 =>  sprintf( __( 'Select Page for Slider %s title with featured image', 'social-charity' ), $i ),
      'section' => 'social_charity_frontpage_slider_section',
      'type'=> 'dropdown-pages',
      'settings' => 'social_charity_slider_title_'.$i
    )
  );

  $wp_customize->add_setting( 'social_charity_slider_button_1_title_'.$i, array(
    'capability'            => 'edit_theme_options',
    'default'               => '',
    'sanitize_callback'     => 'sanitize_text_field'
  ) );

  $wp_customize->add_control( 'social_charity_slider_button_1_title_'.$i, array(
    /* translators: %s: Description */ 
    'label'                 =>  sprintf( __( 'First Button Title For Slider %s', 'social-charity' ), $i ),
    'description'           =>  __( 'Join with Us', 'social-charity' ),
    'section'               => 'social_charity_frontpage_slider_section',
    'type'                  => 'text',
    'settings' => 'social_charity_slider_button_1_title_'.$i,
  ) );

  $wp_customize->add_setting( 'social_charity_slider_button_1_url_'.$i, array(
    'capability'            => 'edit_theme_options',
    'default'               => '',
    'sanitize_callback'     => 'esc_url_raw'
  ) );

  $wp_customize->add_control( 'social_charity_slider_button_1_url_'.$i, array(
    /* translators: %s: Description */ 
    'label'                 =>  sprintf( __( 'Select URL For button Title 1 of slider  %s', 'social-charity' ), $i ),
    'description'           =>  __( '#', 'social-charity' ),
    'section'               => 'social_charity_frontpage_slider_section',
    'type'                  => 'url',
    'settings' => 'social_charity_slider_button_1_url_'.$i,
  ) );
}
/*----------------------------------------------------------------------------------------------------------------------------------------*/
/**
 * Front page Service section
 *
 * @since 1.0.0
 */

$wp_customize->add_section(
  'social_charity_frontpage_service_section',
  array(
    'priority'       => 2,
    'panel'          => 'social_charity_frontpage_settings_panel',
    'capability'     => 'edit_theme_options',
    'theme_supports' => '',
    'title'          => __( 'Service Section', 'social-charity' ),
    'description'    => __( 'Managed the Service display at Frontpage section.', 'social-charity' ),
  )
);

/**
 * Enable/Disable for service
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
  'social_charity_service_enable',
  array(
    'default'           => 0,
    'sanitize_callback' => 'social_charity_sanitize_checkbox',
  )
);

$wp_customize->add_control(
  'social_charity_service_enable',
  array(
    'section'     => 'social_charity_frontpage_service_section',
    'label'       => __( 'Enable/Disable for service', 'social-charity' ),
    'type'        => 'checkbox'
  )       
);

$service_arrays = array( '1'=>'fa fa-usd','2'=> 'fa fa-handshake-o','3'=>'fa fa-paperclip');
foreach($service_arrays as $key => $service_icon) {
// Select Page For Service.
  $wp_customize->add_setting( 'social_charity_service_title_'.$key, array(
    'capability'            => 'edit_theme_options',
    'default'               => '',
    'sanitize_callback'     => 'social_charity_sanitize_dropdown_pages'
  ) );

  $wp_customize->add_control('social_charity_service_title_'.$key,
    array(
      /* translators: %s: Service. */
      'label'                 =>  sprintf( __( 'Select Page for Service %s', 'social-charity' ), $key ),
      'section' => 'social_charity_frontpage_service_section',
      'type'=> 'dropdown-pages',
      'settings' => 'social_charity_service_title_'.$key
    )
  );

  $wp_customize->add_setting( 'social_charity_service_icon_'.$key, array(
    'capability'            => 'edit_theme_options',
    'default'               => '',
    'sanitize_callback'     => 'sanitize_text_field'
  ) );

  $wp_customize->add_control( 'social_charity_service_icon_'.$key, array(
    /* translators: %s: key value */ 
    'label'                 =>  sprintf( __( 'Select icon For Service %s', 'social-charity' ), $key ),
    /* translators: %s: icon value */ 
    'description'           => sprintf( __( 'Use font awesome icon: Eg:%1$s. %2$s See more here %3$s', 'social-charity' ), $service_icon,'<a href="'.esc_url('http://fontawesome.io/icons/').'" target="_blank">','</a>'),
    'section'               => 'social_charity_frontpage_service_section',
    'type'                  => 'text',
    'settings' => 'social_charity_service_icon_'.$key,
  ) );
}

/*----------------------------------------------------------------------------------------------------------------------------------------*/
/**
 * Front page Our Causes section
 *
 * @since 1.0.0
 */

$wp_customize->add_section(
  'social_charity_frontpage_our_causes_section',
  array(
   'priority'       => 3,
   'panel'          => 'social_charity_frontpage_settings_panel',
   'capability'     => 'edit_theme_options',
   'theme_supports' => '',
   'title'          => __( 'Our Causes Section', 'social-charity' ),
   'description'    => __( 'Managed the Our Causes display at Frontpage section.', 'social-charity' ),
 )
);

/**
 * Enable/Disable for Our Causes
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
  'social_charity_causes_enable',
  array(
    'default'           => 0,
    'sanitize_callback' => 'social_charity_sanitize_checkbox',
  )
);

$wp_customize->add_control(
  'social_charity_causes_enable',
  array(
    'section'     => 'social_charity_frontpage_our_causes_section',
    'label'       => __( 'Enable/Disable for  Our Causes', 'social-charity' ),
    'type'        => 'checkbox'
  )       
);


/** Causes Text */
$wp_customize->add_setting(
  'social_charity_causes_text',
  array(
    'default'           => __( 'Our Causes', 'social-charity' ),
    'sanitize_callback' => 'sanitize_text_field',
    'transport'         => 'postMessage'
  )
);

$wp_customize->add_control(
  'social_charity_causes_text',
  array(
    'label'    => __( 'Causes Heading', 'social-charity' ),
    'section'  => 'social_charity_frontpage_our_causes_section',
    'type'     => 'text',
  )
);

$wp_customize->selective_refresh->add_partial( 'social_charity_causes_text', array(
  'selector' => '.causes main-title h2',
  'render_callback' => 'social_charity_get_causes_text',
) );


$wp_customize->add_setting( 'social_charity_causes_number', array(
  'capability'            => 'edit_theme_options',
  'default'               => '3',
  'sanitize_callback'     => 'absint'
));

$wp_customize->add_control( 'social_charity_causes_number', array(
  'label'                 =>  __( 'Number of Recent Causes to Show in Front Page', 'social-charity' ),
  'description'           =>  __( 'input 3,4,5,6,7,8,9,10', 'social-charity' ),
  'section'               => 'social_charity_frontpage_our_causes_section',
  'type'                  => 'number',
  'settings' => 'social_charity_causes_number',
) );

if(social_charity_check_wp_give_plugin_activation()):
class Social_Charity_Causes_Page_link extends WP_Customize_Control {
    public $type = 'customtext';
    public $extra = ''; // we add this for the extra description
    public function render_content() {
    ?>
    <label>            
        <a href="<?php echo esc_url( 'edit.php?post_type=give_forms' ); ?>" target='_blank'><?php echo esc_html( $this->label ); ?></a>
        <span><?php echo esc_html( $this->extra ); ?></span>         
    </label>
    <?php
    }
}
$wp_customize->add_setting('social_charity_go_to_give_form', array(
  'default' => '',
  'type' => 'customtext',
  'capability' => 'edit_theme_options',
  'transport' => 'refresh',
  'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( new Social_Charity_Causes_Page_link( $wp_customize, 'social_charity_go_to_give_form', array(
    'label' => esc_attr__( 'Go to Give form Page', 'social-charity' ),
    'section' => 'social_charity_frontpage_our_causes_section',
    'settings' => 'social_charity_go_to_give_form',
    'extra' => esc_attr__( 'click here', 'social-charity' )
    ) ) 
);
endif;
/*----------------------------------------------------------------------------------------------------------------------------------------*/
/**
 * Front page who we are section
 *
 * @since 1.0.0
 */

$wp_customize->add_section(
  'social_charity_frontpage_who_we_are_section',
  array(
    'priority'       => 4,
    'panel'          => 'social_charity_frontpage_settings_panel',
    'capability'     => 'edit_theme_options',
    'theme_supports' => '',
    'title'          => __( 'Who We Are Section', 'social-charity' ),
    'description'    => __( 'Managed the who we are display at Frontpage section.', 'social-charity' ),
  )
);

/**
 * Enable/Disable for who we are
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
  'social_charity_who_we_are_enable',
  array(
    'default'           => 0,
    'sanitize_callback' => 'social_charity_sanitize_checkbox',
  )
);

$wp_customize->add_control(
  'social_charity_who_we_are_enable',
  array(
    'section'     => 'social_charity_frontpage_who_we_are_section',
    'label'       => __( 'Enable/Disable for who we are', 'social-charity' ),
    'type'        => 'checkbox'
  )       
);

/** Who we are title and description with featured image */

$wp_customize->add_setting( 'social_charity_who_we_are', array(
  'capability'            => 'edit_theme_options',
  'default'               => '',
  'sanitize_callback'     => 'social_charity_sanitize_dropdown_pages'
) );

$wp_customize->add_control('social_charity_who_we_are',
  array(
    'label'                 =>  __( 'Select Page for who we are having featured Image', 'social-charity' ),
    'section' => 'social_charity_frontpage_who_we_are_section',
    'type'=> 'dropdown-pages',
    'settings' => 'social_charity_who_we_are'
  )
);


/*----------------------------------------------------------------------------------------------------------------------------------------*/
/**
 * Front page Upcoming Events section
 *
 * @since 1.0.0
 */

$wp_customize->add_section(
  'social_charity_frontpage_events_section',
  array(
    'priority'       => 5,
    'panel'          => 'social_charity_frontpage_settings_panel',
    'capability'     => 'edit_theme_options',
    'theme_supports' => '',
    'title'          => __( 'Events Section', 'social-charity' ),
    'description'    => __( 'Managed the  Events display at Frontpage section.', 'social-charity' ),
  )
);

/**
 * Enable/Disable for  Events
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
  'social_charity_events_enable',
  array(
    'default'           => 0,
    'sanitize_callback' => 'social_charity_sanitize_checkbox',
  )
);

$wp_customize->add_control(
  'social_charity_events_enable',
  array(
    'section'     => 'social_charity_frontpage_events_section',
    'label'       => __( 'Enable/Disable for Events', 'social-charity' ),
    'type'        => 'checkbox'
  )       
);


/** Latest Events Text */
$wp_customize->add_setting(
  'social_charity_events_text',
  array(
    'default'           => __( 'Our Events', 'social-charity' ),
    'sanitize_callback' => 'sanitize_text_field',
    'transport'         => 'postMessage'
  )
);

$wp_customize->add_control(
  'social_charity_events_text',
  array(
    'label'    => __( 'Events Heading', 'social-charity' ),
    'section'  => 'social_charity_frontpage_events_section',
    'type'     => 'text',
  )
);

$wp_customize->selective_refresh->add_partial( 'social_charity_events_text', array(
  'selector' => '.events main-title h2',
  'render_callback' => 'social_charity_get_events_text',
) );


//Category select for Events
$wp_customize->add_setting('social_charity_events_category_id',array(
  'capability'        => 'edit_theme_options',
  'sanitize_callback' => 'social_charity_sanitize_category',
  'default' =>  '1',
)
);

$wp_customize->add_control(new Social_Charity_Customize_Dropdown_Taxonomies_Control($wp_customize,'social_charity_events_category_id',
  array(
   'label' => __('Select Category for Events','social-charity'),
   'section' => 'social_charity_frontpage_events_section',
   'settings' => 'social_charity_events_category_id',
   'type'=> 'dropdown-taxonomies',
 )
));

$wp_customize->add_setting( 'social_charity_events_number', array(
  'capability'            => 'edit_theme_options',
  'default'               => '4',
  'sanitize_callback'     => 'absint'
));

$wp_customize->add_control( 'social_charity_events_number', array(
  'label'                 =>  __( 'Number of event to Show in Front Page', 'social-charity' ),
  'description'           =>  __( 'input 3,4,5,6,7,8,9,10', 'social-charity' ),
  'section'               => 'social_charity_frontpage_events_section',
  'type'                  => 'number',
  'settings' => 'social_charity_events_number',
) );


/*----------------------------------------------------------------------------------------------------------------------------------------*/
/**
 * Front page Volunteer section
 *
 * @since 1.0.0
 */

$wp_customize->add_section(
  'social_charity_frontpage_volunteer_section',
  array(
    'priority'       => 6,
    'panel'          => 'social_charity_frontpage_settings_panel',
    'capability'     => 'edit_theme_options',
    'theme_supports' => '',
    'title'          => __( 'Volunteer Section', 'social-charity' ),
    'description'    => __( 'Managed the Volunteer display at Frontpage section.', 'social-charity' ),
  )
);

/**
 * Enable/Disable for Volunteer
 *
 * @since 1.0.0
 */

$wp_customize->add_setting( 'social_charity_volunteer_s_enable', array(
  'capability'            => 'edit_theme_options',
  'default'               => 0,
  'sanitize_callback'     => 'social_charity_sanitize_checkbox'
) );

$wp_customize->add_control('social_charity_volunteer_s_enable',
  array(
    'label'   =>  __( 'Enable/Disable for Volunteer', 'social-charity'  ),
    'section' => 'social_charity_frontpage_volunteer_section',
    'type'=> 'checkbox',
    'settings' => 'social_charity_volunteer_s_enable'
  )
);



/** Volunteer title and description with featured image */

$wp_customize->add_setting( 'social_charity_volunteer', array(
  'capability'            => 'edit_theme_options',
  'default'               => '',
  'sanitize_callback'     => 'social_charity_sanitize_dropdown_pages'
) );

$wp_customize->add_control('social_charity_volunteer',
  array(
    'label'                 =>  __( 'Select Page for Volunteer', 'social-charity'  ),
    'section' => 'social_charity_frontpage_volunteer_section',
    'type'=> 'dropdown-pages',
    'settings' => 'social_charity_volunteer'
  )
);


/*----------------------------------------------------------------------------------------------------------------------------------------*/
/**
 * Front page Newsletter section
 *
 * @since 1.0.0
 */

$wp_customize->add_section(
  'social_charity_frontpage_newsletter_section',
  array(
    'priority'       => 7,
    'panel'          => 'social_charity_frontpage_settings_panel',
    'capability'     => 'edit_theme_options',
    'theme_supports' => '',
    'title'          => __( 'Newsletter Section', 'social-charity' ),
    'description'    => __( 'Managed the Newsletter display at Frontpage section.', 'social-charity' ),
  )
);

/**
 * Enable/Disable for Newsletter
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
  'social_charity_volunteer_newsletter_enable',
  array(
    'default'           => 0,
    'sanitize_callback' => 'social_charity_sanitize_checkbox',
  )
);

$wp_customize->add_control(
  'social_charity_volunteer_newsletter_enable',
  array(
    'section'     => 'social_charity_frontpage_newsletter_section',
    'label'       => __( 'Enable/Disable for Newsletter', 'social-charity' ),
    'type'        => 'checkbox'
  )       
);

// Newsletter Title
$wp_customize->add_setting('social_charity_newsletter_quote',array(
  'default'       =>      '',
  'sanitize_callback'     =>  'sanitize_text_field'
));

$wp_customize->add_control('social_charity_newsletter_quote',array(
  'section'       =>      'social_charity_frontpage_newsletter_section',
  'label'         =>      __('Newsletter Title', 'social-charity'),
  'description'   =>      __('Eg:- Want to join us?', 'social-charity'),
  'type'          =>      'text',
  'settings'    =>    'social_charity_newsletter_quote'
));


// Newsletter Form Shortcode Descriptions
$wp_customize->add_setting('social_charity_f_newsletter_shortcode',array(
  'default'       =>      '',
  'sanitize_callback'     =>  'sanitize_text_field'
));
$wp_customize->add_control('social_charity_f_newsletter_shortcode',array(
  'section'       =>      'social_charity_frontpage_newsletter_section',
  'label'                 =>  __( 'News Letter Section Use Shortcode', 'social-charity' ),
  /* translators: %s: Description */ 
  'description'           => sprintf( __( 'Use Newsletter Plugins shortcode: Eg: %1$s. %2$s See more here %3$s', 'social-charity' ), '[newsletter_form]','<a href="'.esc_url('https://wordpress.org/plugins/newsletter/').'" target="_blank">','</a>' ),
  'type'          =>      'text',
  'settings'    =>    'social_charity_f_newsletter_shortcode'
));

/*----------------------------------------------------------------------------------------------------------------------------------------*/
/**
 * Front page Testimonials section
 *
 * @since 1.0.0
 */

$wp_customize->add_section(
  'social_charity_frontpage_testimonials_section',
  array(
    'priority'       => 8,
    'panel'          => 'social_charity_frontpage_settings_panel',
    'capability'     => 'edit_theme_options',
    'theme_supports' => '',
    'title'          => __( 'Testimonials Section', 'social-charity' ),
    'description'    => __( 'Managed the  Testimonials display at Frontpage section.', 'social-charity' ),
  )
);

/**
 * Enable/Disable for Testimonials
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
  'social_charity_testimonials_enable',
  array(
    'default'           => 0,
    'sanitize_callback' => 'social_charity_sanitize_checkbox',
  )
);

$wp_customize->add_control(
  'social_charity_testimonials_enable',
  array(
    'section'     => 'social_charity_frontpage_testimonials_section',
    'label'       => __( 'Enable/Disable for Testimonials', 'social-charity' ),
    'type'        => 'checkbox'
  )       
);

/** Testimonials Text */
$wp_customize->add_setting(
  'social_charity_tetimonials_text',
  array(
    'default'           => __( 'What People Say', 'social-charity' ),
    'sanitize_callback' => 'sanitize_text_field',
    'transport'         => 'postMessage'
  )
);

$wp_customize->add_control(
  'social_charity_tetimonials_text',
  array(
    'label'    => __( 'Testimonials Heading', 'social-charity' ),
    'section'  => 'social_charity_frontpage_testimonials_section',
    'type'     => 'text',
  )
);

$wp_customize->selective_refresh->add_partial( 'social_charity_tetimonials_text', array(
  'selector' => '.testimonial main-title h2',
  'render_callback' => 'social_charity_get_testimonials_text',
) );


//Select Page for Testimonials
for ($i=1;$i<7;$i++) {
  $wp_customize->add_setting( 'social_charity_testimonial_page_'.$i, array(
    'capability'            => 'edit_theme_options',
    'default'               => '',
    'sanitize_callback'     => 'social_charity_sanitize_dropdown_pages'
  ) );


  $wp_customize->add_control( 'social_charity_testimonial_page_'.$i, array(
    /* translators: %s: Description */ 
    'label'                 => sprintf( __( 'Select Testimonial Page %s', 'social-charity' ), $i ),
    'section'               => 'social_charity_frontpage_testimonials_section',
    'type'                  => 'dropdown-pages',
    'settings'              => 'social_charity_testimonial_page_'.$i,
  ) );

  $wp_customize->add_setting( 'social_charity_testimonial_position_'.$i, array(
    'capability'            => 'edit_theme_options',
    'default'               => '',
    'sanitize_callback'     => 'sanitize_text_field'
  ) );


  $wp_customize->add_control( 'social_charity_testimonial_position_'.$i, array(
   /* translators: %s: Description */ 
   'label'                 =>  sprintf( __( 'Select Designation or Company Name %s', 'social-charity' ), $i ),
   'description'           =>  __( 'Position like Developer, CEO MD', 'social-charity' ),
   'section'               => 'social_charity_frontpage_testimonials_section',
   'type'                  => 'text',
   'settings' => 'social_charity_testimonial_position_'.$i,
 ) );
}

/*----------------------------------------------------------------------------------------------------------------------------------------*/
/**
 * Front page Gallery section
 *
 * @since 1.0.0
 */

$wp_customize->add_section(
  'social_charity_frontpage_gallery_section',
  array(
    'priority'       => 9,
    'panel'          => 'social_charity_frontpage_settings_panel',
    'capability'     => 'edit_theme_options',
    'theme_supports' => '',
    'title'          => __( 'Gallery Section', 'social-charity' ),
    'description'    => __( 'Managed the  Gallery display at Frontpage section.', 'social-charity' ),
  )
);

/**
 * Enable/Disable for Gallery
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
  'social_charity_gallery_enable',
  array(
    'default'           => 0,
    'sanitize_callback' => 'social_charity_sanitize_checkbox',
  )
);

$wp_customize->add_control(
  'social_charity_gallery_enable',
  array(
    'section'     => 'social_charity_frontpage_gallery_section',
    'label'       => __( 'Enable/Disable for Gallery', 'social-charity' ),
    'type'        => 'checkbox'
  )       
);

/** Gallery Text */
$wp_customize->add_setting(
  'social_charity_gallery_text',
  array(
    'default'           => __( 'Our Gallery', 'social-charity' ),
    'sanitize_callback' => 'sanitize_text_field',
    'transport'         => 'postMessage'
  )
);

$wp_customize->add_control(
  'social_charity_gallery_text',
  array(
    'label'    => __( 'Gallery Heading', 'social-charity' ),
    'section'  => 'social_charity_frontpage_gallery_section',
    'type'     => 'text',
  )
);

$wp_customize->selective_refresh->add_partial( 'social_charity_gallery_text', array(
  'selector' => '.gallery main-title h2',
  'render_callback' => 'social_charity_get_gallery_text',
) );

$wp_customize->add_setting('social_charity_gallery_category_id',array(
  'capability'            => 'edit_theme_options',
  'default' =>  '',
  'sanitize_callback' => 'social_charity_sanitize_category',
));
    
$wp_customize->add_control(new Social_Charity_Customize_Dropdown_Taxonomies_Control($wp_customize,'social_charity_gallery_category_id',
array(
       'label' => __('Select Category for Gallery having subcategories','social-charity'),
       'description' => __('Category posts have featured image','social-charity'),
        'section' => 'social_charity_frontpage_gallery_section',
        'settings' => 'social_charity_gallery_category_id',
        'type'=> 'dropdown-taxonomies',
    )
));

/*----------------------------------------------------------------------------------------------------------------------------------------*/
/**
 * Front page blog section
 *
 * @since 1.0.0
 */

$wp_customize->add_section(
  'social_charity_frontpage_blog_section',
  array(
    'priority'       => 10,
    'panel'          => 'social_charity_frontpage_settings_panel',
    'capability'     => 'edit_theme_options',
    'theme_supports' => '',
    'title'          => __( 'Blog Section', 'social-charity' ),
    'description'    => __( 'Managed the  Blog display at Frontpage section.', 'social-charity' ),
  )
);

/**
 * Enable/Disable for Blog Section
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
  'social_charity_blog_enable',
  array(
    'default'           => 1,
    'sanitize_callback' => 'social_charity_sanitize_checkbox',
  )
);

$wp_customize->add_control(
  'social_charity_blog_enable',
  array(
    'section'     => 'social_charity_frontpage_blog_section',
    'label'       => __( 'Enable/Disable for Blog', 'social-charity' ),
    'type'        => 'checkbox'
  )       
);


/** Blogs Text */
$wp_customize->add_setting(
  'social_charity_blog_text',
  array(
    'default'           => __( 'Latest Blog', 'social-charity' ),
    'sanitize_callback' => 'sanitize_text_field',
    'transport'         => 'postMessage'
  )
);

$wp_customize->add_control(
  'social_charity_blog_text',
  array(
    'label'    => __( 'Blog Heading', 'social-charity' ),
    'section'  => 'social_charity_frontpage_blog_section',
    'type'     => 'text',
  )
);

$wp_customize->selective_refresh->add_partial( 'social_charity_blog_text', array(
  'selector' => '.blog main-title h2',
  'render_callback' => 'social_charity_get_blog_text',
) );
//Category select for blogs
$wp_customize->add_setting('social_charity_blog_category_id',array(
  'capability'        => 'edit_theme_options',
  'sanitize_callback' => 'social_charity_sanitize_category',
  'default' =>  '1',
)
);

$wp_customize->add_control(new Social_Charity_Customize_Dropdown_Taxonomies_Control($wp_customize,'social_charity_blog_category_id',
  array(
   'label' => __('Select Category for Blog','social-charity'),
   'section' => 'social_charity_frontpage_blog_section',
   'settings' => 'social_charity_blog_category_id',
   'type'=> 'dropdown-taxonomies',
 )
));

$wp_customize->add_setting( 'social_charity_blog_number', array(
  'capability'            => 'edit_theme_options',
  'default'               => '3',
  'sanitize_callback'     => 'absint'
));

$wp_customize->add_control( 'social_charity_blog_number', array(
  'label'                 =>  __( 'Number of Recent Blogs to Show in Front Page', 'social-charity' ),
  'description'           =>  __( 'input 3,4,5,6,7,8,9,10', 'social-charity' ),
  'section'               => 'social_charity_frontpage_blog_section',
  'type'                  => 'number',
  'settings' => 'social_charity_blog_number',
) );
}