<?php
/**
* Featured Post Section options
*
* @package Theme Palace
* @subpackage Power News
* @since Power News 1.0.0
*/

// Add Featured Post section
$wp_customize->add_section( 'power_news_featured_posts_section', array(
	'title'             => esc_html__( 'Featured Post','power-news' ),
	'description'       => esc_html__( 'Featured Post Section options.', 'power-news' ),
	'panel'             => 'power_news_front_page_panel',
) );

// Featured Post content enable control and setting
$wp_customize->add_setting( 'power_news_theme_options[featured_posts_section_enable]', array(
	'default'			=> 	$options['featured_posts_section_enable'],
	'sanitize_callback' => 'power_news_sanitize_switch_control',
	) );

$wp_customize->add_control( new Power_News_Switch_Control( $wp_customize, 'power_news_theme_options[featured_posts_section_enable]', array(
	'label'             => esc_html__( 'Featured Post Section Enable', 'power-news' ),
	'section'           => 'power_news_featured_posts_section',
	'on_off_label' 		=> power_news_switch_options(),
	) ) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'power_news_theme_options[featured_posts_section_enable]', array(
		'selector'      => '.featured-posts-section .tooltiptext',
		'settings'      => 'power_news_theme_options[featured_posts_section_enable]',
    ) );
}

// Add dropdown category setting and control.
$wp_customize->add_setting(  'power_news_theme_options[featured_posts_content_category]', array(
	'sanitize_callback' => 'power_news_sanitize_single_category',
	) ) ;

$wp_customize->add_control( new Power_News_Dropdown_Taxonomies_Control( $wp_customize,'power_news_theme_options[featured_posts_content_category]', array(
	'label'             => esc_html__( 'Select Category', 'power-news' ),
	'description'      	=> esc_html__( 'Note: Latest selected no of posts will be shown from selected category', 'power-news' ),
	'section'           => 'power_news_featured_posts_section',
	'type'              => 'dropdown-taxonomies',
	'active_callback'	=> 'power_news_is_featured_posts_section_enable'
	) ) );