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

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

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

$wp_customize->add_control( new Power_News_Switch_Control( $wp_customize, 'power_news_theme_options[multi_post_section_enable]', array(
	'label'             => esc_html__( 'Multi Post Section Enable', 'power-news' ),
	'section'           => 'power_news_multiple_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[multi_post_section_enable]', array(
		'selector'      => '.multiple-posts-section .tooltiptext',
		'settings'      => 'power_news_theme_options[multi_post_section_enable]',
    ) );
}

// multi posts title setting and control
$wp_customize->add_setting( 'power_news_theme_options[multi_post_col1_title]', array(
	'sanitize_callback' => 'sanitize_text_field',
	'default'			=> $options['multi_post_col1_title'],
	'transport'			=> 'postMessage',
	) );

$wp_customize->add_control( 'power_news_theme_options[multi_post_col1_title]', array(
	'label'           	=> esc_html__( 'Column 1 Title', 'power-news' ),
	'section'        	=> 'power_news_multiple_posts_section',
	'active_callback' 	=> 'power_news_is_multi_post_section_enable',
	'type'				=> 'text',
	) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
	$wp_customize->selective_refresh->add_partial( 'power_news_theme_options[multi_post_col1_title]', array(
		'selector'            => '#power_news_multiple_posts_section .col1 h2',
		'settings'            => 'power_news_theme_options[multi_post_col1_title]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'power_news_multi_post_col1_title_partial',
		) );
}

// Add dropdown category setting and control.
$wp_customize->add_setting(  'power_news_theme_options[multi_post_col1_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[multi_post_col1_content_category]', array(
	'label'             => esc_html__( 'Select Category', 'power-news' ),
	'description'      	=> esc_html__( 'Note: Multi selected no of posts will be shown from selected category', 'power-news' ),
	'section'           => 'power_news_multiple_posts_section',
	'type'              => 'dropdown-taxonomies',
	'active_callback'	=> 'power_news_is_multi_post_section_enable'
	) ) );


    
// multi posts hr setting and control
$wp_customize->add_setting( 'power_news_theme_options[multi_post_hr]', array(
	'sanitize_callback' => 'sanitize_text_field'
	) );

$wp_customize->add_control( new Power_News_Customize_Horizontal_Line( $wp_customize, 'power_news_theme_options[multi_post_hr]',
	array(
		'section'         => 'power_news_multiple_posts_section',
		'active_callback' => 'power_news_is_multi_post_section_enable',
        'type'			  => 'hr'
    )));
/**
* Multi Post column 2 Section options
*
* @package Theme Palace
* @subpackage Power News
* @since Power News 1.0.0
*/

// multi posts title setting and control
$wp_customize->add_setting( 'power_news_theme_options[multi_post_col2_title]', array(
	'sanitize_callback' => 'sanitize_text_field',
	'default'			=> $options['multi_post_col2_title'],
	'transport'			=> 'postMessage',
	) );

$wp_customize->add_control( 'power_news_theme_options[multi_post_col2_title]', array(
	'label'           	=> esc_html__( 'Column 2 Title', 'power-news' ),
	'section'        	=> 'power_news_multiple_posts_section',
	'active_callback' 	=> 'power_news_is_multi_post_section_enable',
	'type'				=> 'text',
	) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
	$wp_customize->selective_refresh->add_partial( 'power_news_theme_options[multi_post_col2_title]', array(
		'selector'            => '#power_news_multiple_posts_section .col2 h2',
		'settings'            => 'power_news_theme_options[multi_post_col2_title]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'power_news_multi_post_col2_title_partial',
		) );
}

// Add dropdown category setting and control.
$wp_customize->add_setting(  'power_news_theme_options[multi_post_col2_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[multi_post_col2_content_category]', array(
	'label'             => esc_html__( 'Select Category', 'power-news' ),
	'description'      	=> esc_html__( 'Note: Multi selected no of posts will be shown from selected category', 'power-news' ),
	'section'           => 'power_news_multiple_posts_section',
	'type'              => 'dropdown-taxonomies',
	'active_callback'	=> 'power_news_is_multi_post_section_enable'
	) ) );