<?php
/**
 * Blog / Archive Options
 */

$wp_customize->add_section(
	'nostalgic_blog_archive_page_options',
	array(
		'title' => esc_html__( 'Blog / Archive Pages Options', 'nostalgic-blog' ),
		'panel' => 'nostalgic_blog_theme_options_panel',
	)
);

// Excerpt - Excerpt Length.
$wp_customize->add_setting(
	'nostalgic_blog_excerpt_length',
	array(
		'default'           => 40,
		'sanitize_callback' => 'nostalgic_blog_sanitize_number_range',
	)
);

$wp_customize->add_control(
	'nostalgic_blog_excerpt_length',
	array(
		'label'       => esc_html__( 'Excerpt Length (no. of words)', 'nostalgic-blog' ),
		'section'     => 'nostalgic_blog_archive_page_options',
		'settings'    => 'nostalgic_blog_excerpt_length',
		'type'        => 'number',
		'input_attrs' => array(
			'min'  => 5,
			'max'  => 200,
			'step' => 1,
		),
	)
);

// Enable archive page category setting.
$wp_customize->add_setting(
	'nostalgic_blog_enable_archive_category',
	array(
		'default'           => true,
		'sanitize_callback' => 'nostalgic_blog_sanitize_checkbox',
	)
);

$wp_customize->add_control(
	new Nostalgic_Blog_Toggle_Checkbox_Custom_control(
		$wp_customize,
		'nostalgic_blog_enable_archive_category',
		array(
			'label'    => esc_html__( 'Enable Category', 'nostalgic-blog' ),
			'settings' => 'nostalgic_blog_enable_archive_category',
			'section'  => 'nostalgic_blog_archive_page_options',
			'type'     => 'checkbox',
		)
	)
);

// Enable archive page author setting.
$wp_customize->add_setting(
	'nostalgic_blog_enable_archive_author',
	array(
		'default'           => true,
		'sanitize_callback' => 'nostalgic_blog_sanitize_checkbox',
	)
);

$wp_customize->add_control(
	new Nostalgic_Blog_Toggle_Checkbox_Custom_control(
		$wp_customize,
		'nostalgic_blog_enable_archive_author',
		array(
			'label'    => esc_html__( 'Enable Author', 'nostalgic-blog' ),
			'settings' => 'nostalgic_blog_enable_archive_author',
			'section'  => 'nostalgic_blog_archive_page_options',
			'type'     => 'checkbox',
		)
	)
);

// Enable archive page date setting.
$wp_customize->add_setting(
	'nostalgic_blog_enable_archive_date',
	array(
		'default'           => true,
		'sanitize_callback' => 'nostalgic_blog_sanitize_checkbox',
	)
);

$wp_customize->add_control(
	new Nostalgic_Blog_Toggle_Checkbox_Custom_control(
		$wp_customize,
		'nostalgic_blog_enable_archive_date',
		array(
			'label'    => esc_html__( 'Enable Date', 'nostalgic-blog' ),
			'settings' => 'nostalgic_blog_enable_archive_date',
			'section'  => 'nostalgic_blog_archive_page_options',
			'type'     => 'checkbox',
		)
	)
);
