<?php
/**
 * Theme Ostrich Customizer
 *
 * @package Ostrich Magazine
 *
 * recent section
 */



$wp_customize->add_section(
	'ostrich_magazine_recent',
	array(
		'title' => esc_html__( 'Recent Section', 'ostrich-magazine' ),
		'panel' => 'ostrich_magazine_home_panel',
	)
);

$wp_customize->add_setting( 'ostrich_magazine_recent_enable',
	array(
		'default' => 0,
		'transport' => 'refresh',
		'sanitize_callback' => 'ostrich_magazine_switch_sanitization'
	)
);
$wp_customize->add_control( new Ostrich_Magazine_Toggle_Switch_Custom_control( $wp_customize, 'ostrich_magazine_recent_enable',
	array(
		'label' => esc_html__( 'Enable Recent Section', 'ostrich-magazine' ),
		'section' => 'ostrich_magazine_recent'
	)
) );

$wp_customize->add_setting(
	'ostrich_magazine_recent_label',
	array(
		'sanitize_callback' => 'sanitize_text_field',
		'default' => esc_html__( 'Hot Topics', 'ostrich-magazine' ),
	)
);

$wp_customize->add_control(
	'ostrich_magazine_recent_label',
	array(
		'section'		=> 'ostrich_magazine_recent',
		'label'			=> esc_html__( 'Hot Topic Section Label', 'ostrich-magazine' ),
		'active_callback'	=> 'ostrich_magazine_if_recent_enabled',
	)
);


for ($i=1; $i <= 2 ; $i++) { 
// recent category setting
$wp_customize->add_setting(
	'ostrich_magazine_recent_cat_'.$i,
	array(
		'sanitize_callback' => 'ostrich_magazine_sanitize_select',
	)
);

$wp_customize->add_control(
	'ostrich_magazine_recent_cat_'.$i,
	array(
		'section'		=> 'ostrich_magazine_recent',
		'label'			=> esc_html__( 'Category ', 'ostrich-magazine' ).$i,
		'active_callback' => 'ostrich_magazine_if_recent_enabled',
		'type'			=> 'select',
		'choices'		=> ostrich_magazine_get_post_cat_choices(),
	)
);

}
