<?php
/**
 * Theme Ostrich Customizer
 *
 * @package Return Blog
 *
 * blog section
 */
$wp_customize->add_section(
	'return_blog_blog',
	array(
		'title' => esc_html__( 'Blog Post', 'return-blog' ),
		'panel' => 'return_blog_home_panel',
	)
);

$wp_customize->add_setting(
	'return_blog_blog_title',
	array(
		'sanitize_callback' => 'sanitize_text_field',
		'transport'	=> 'postMessage',
	)
);
$wp_customize->add_control(
	'return_blog_blog_title',
	array(
		'section'		=> 'return_blog_blog',
		'label'			=> esc_html__( 'Section Title:', 'return-blog' ),
		'active_callback' => 'return_blog_if_blog_enabled'
	)
);

$wp_customize->add_setting(
	'return_blog_blog_sub_title',
	array(
		'sanitize_callback' => 'sanitize_text_field',
		'transport'	=> 'postMessage',
	)
);
$wp_customize->add_control(
	'return_blog_blog_sub_title',
	array(
		'section'		=> 'return_blog_blog',
		'label'			=> esc_html__( 'Section Sub Title:', 'return-blog' ),
		'active_callback' => 'return_blog_if_blog_enabled'
	)
);

// blog enable settings
$wp_customize->add_setting(
	'return_blog_blog',
	array(
		'sanitize_callback' => 'return_blog_sanitize_select',
		'default' => 'disable',
	)
);
$wp_customize->add_control(
	'return_blog_blog',
	array(
		'section'		=> 'return_blog_blog',
		'label'			=> esc_html__( 'Content type:', 'return-blog' ),
		'description'			=> esc_html__( 'Choose where you want to render the content from.', 'return-blog' ),
		'type'			=> 'select',
		'choices'		=> array(
				'disable' => esc_html__( '--Disable--', 'return-blog' ),
				'post' => esc_html__( 'Post', 'return-blog' ),
		 	)
	)
);

for ($i=1; $i <= 6 ; $i++) {
	// blog post setting
	$wp_customize->add_setting(
		'return_blog_blog_post_'.$i,
		array(
			'sanitize_callback' => 'return_blog_sanitize_dropdown_pages',
		)
	);
	$wp_customize->add_control(
		'return_blog_blog_post_'.$i,
		array(
			'section'		=> 'return_blog_blog',
			'label'			=> esc_html__( 'Post ', 'return-blog' ).$i,
			'active_callback' => 'return_blog_if_blog_post',
			'type'			=> 'select',
			'choices'		=> return_blog_get_post_choices(),
		)
	);
	// blog page setting
	$wp_customize->add_setting(
		'return_blog_blog_page_'.$i,
		array(
			'sanitize_callback' => 'return_blog_sanitize_dropdown_pages',
			'default' => 0,
		)
	);
	$wp_customize->add_control(
		'return_blog_blog_page_'.$i,
		array(
			'section'		=> 'return_blog_blog',
			'label'			=> esc_html__( 'Page ', 'return-blog' ).$i,
			'type'			=> 'dropdown-pages',
			'active_callback' => 'return_blog_if_blog_page'
		)
	);
}
// blog category setting
$wp_customize->add_setting(
	'return_blog_blog_cat',
	array(
		'sanitize_callback' => 'return_blog_sanitize_select',
	)
);
$wp_customize->add_control(
	'return_blog_blog_cat',
	array(
		'section'		=> 'return_blog_blog',
		'label'			=> esc_html__( 'Category:', 'return-blog' ),
		'active_callback' => 'return_blog_if_blog_cat',
		'type'			=> 'select',
		'choices'		=> return_blog_get_post_cat_choices(),
	)
);