<?php
/**
 * Moral Theme Customizer
 *
 * @package Moral
 *
 * editorial section
 */

$wp_customize->add_section(
	'moral_magazine_editorial',
	array(
		'title' => esc_html__( 'Editorial', 'moral-magazine' ),
		'panel' => 'moral_magazine_home_panel',
	)
);


// blog enable settings
$wp_customize->add_setting(
	'moral_magazine_editorial',
	array(
		'sanitize_callback' => 'moral_magazine_sanitize_select',
		'default' => 'disable'
	)
);

$wp_customize->add_control(
	'moral_magazine_editorial',
	array(
		'section'		=> 'moral_magazine_editorial',
		'label'			=> esc_html__( 'Content type:', 'moral-magazine' ),
		'description'			=> esc_html__( 'Choose where you want to render the content from.', 'moral-magazine' ),
		'type'			=> 'select',
		'choices'		=> array( 
				'disable' => esc_html__( '--Disable--', 'moral-magazine' ),
				'post' => esc_html__( 'Post', 'moral-magazine' ),
		 	)
	)
);

$wp_customize->add_setting(
	'moral_magazine_editorial_title',
	array(
		'sanitize_callback' => 'sanitize_text_field',
		'default' => esc_html__( 'editorial POSTS', 'moral-magazine' ),
	)
);

$wp_customize->add_control(
	'moral_magazine_editorial_title',
	array(
		'section'		=> 'moral_magazine_editorial',
		'label'			=> esc_html__( 'Title:', 'moral-magazine' ),
	)
);


$blog_num = 4;
for ($i=1; $i <= $blog_num ; $i++) { 
	// blog post setting
	$wp_customize->add_setting(
		'moral_magazine_editorial_post_'.$i,
		array(
			'sanitize_callback' => 'moral_magazine_sanitize_dropdown_pages',
		)
	);

	$wp_customize->add_control(
		'moral_magazine_editorial_post_'.$i,
		array(
			'section'		=> 'moral_magazine_editorial',
			'label'			=> esc_html__( 'Post ', 'moral-magazine' ).$i,
			'type'			=> 'select',
			'choices'		=> moral_magazine_get_post_choices(),
		)
	);


}

