<?php
/**
 * Theme Options
 *
 * @package Blorigan
 */

$default = blorigan_get_default_theme_options();

// Add theme options panel.
$wp_customize->add_panel(
	'theme_option_panel', array(
		'title'      => esc_html__( 'Theme Options', 'blorigan' ),
		'priority'   => 100,
		'capability' => 'edit_theme_options',
	)
);

// Header Section.
$wp_customize->add_section(
	'section_header', array(
		'title'      => esc_html__( 'Header Options', 'blorigan' ),
		'priority'   => 100,
		'capability' => 'edit_theme_options',
		'panel'      => 'theme_option_panel',
	)
);

// Setting show_title.
$wp_customize->add_setting(
	'theme_options[show_title]', array(
		'default'           => $default['show_title'],
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'blorigan_sanitize_checkbox',
	)
);
$wp_customize->add_control(
	'theme_options[show_title]', array(
		'label'    => esc_html__( 'Show Site Title', 'blorigan' ),
		'section'  => 'section_header',
		'type'     => 'checkbox',
		'priority' => 100,
	)
);

// Setting show_tagline.
$wp_customize->add_setting(
	'theme_options[show_tagline]', array(
		'default'           => $default['show_tagline'],
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'blorigan_sanitize_checkbox',
	)
);
$wp_customize->add_control(
	'theme_options[show_tagline]', array(
		'label'    => esc_html__( 'Show Tagline', 'blorigan' ),
		'section'  => 'section_header',
		'type'     => 'checkbox',
		'priority' => 100,
	)
);

// Layout Section.
$wp_customize->add_section(
	'section_layout', array(
		'title'      => esc_html__( 'Layout Options', 'blorigan' ),
		'priority'   => 100,
		'capability' => 'edit_theme_options',
		'panel'      => 'theme_option_panel',
	)
);

// Setting global_layout.
$wp_customize->add_setting(
	'theme_options[global_layout]', array(
		'default'           => $default['global_layout'],
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'blorigan_sanitize_select',
	)
);
$wp_customize->add_control(
	'theme_options[global_layout]', array(
		'label'    => esc_html__( 'Global Layout', 'blorigan' ),
		'section'  => 'section_layout',
		'type'     => 'select',
		'choices'  => blorigan_get_global_layout_options(),
		'priority' => 100,
	)
);
// Setting archive_layout.
$wp_customize->add_setting(
	'theme_options[archive_layout]', array(
		'default'           => $default['archive_layout'],
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'blorigan_sanitize_select',
	)
);
$wp_customize->add_control(
	'theme_options[archive_layout]', array(
		'label'    => esc_html__( 'Archive Layout', 'blorigan' ),
		'section'  => 'section_layout',
		'type'     => 'select',
		'choices'  => blorigan_get_archive_layout_options(),
		'priority' => 100,
	)
);

// Footer Section.
$wp_customize->add_section(
	'section_footer', array(
		'title'      => esc_html__( 'Footer Options', 'blorigan' ),
		'priority'   => 100,
		'capability' => 'edit_theme_options',
		'panel'      => 'theme_option_panel',
	)
);

// Setting copyright_text.
$wp_customize->add_setting(
	'theme_options[copyright_text]', array(
		'default'           => $default['copyright_text'],
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'theme_options[copyright_text]', array(
		'label'    => esc_html__( 'Copyright Text', 'blorigan' ),
		'section'  => 'section_footer',
		'type'     => 'text',
		'priority' => 100,
	)
);

// Setting go_to_top_status.
$wp_customize->add_setting(
	'theme_options[go_to_top_status]', array(
		'default'           => $default['go_to_top_status'],
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'blorigan_sanitize_checkbox',
	)
);
$wp_customize->add_control(
	'theme_options[go_to_top_status]', array(
		'label'    => esc_html__( 'Enable Go To Top', 'blorigan' ),
		'section'  => 'section_footer',
		'type'     => 'checkbox',
		'priority' => 100,
	)
);

// Blog Section.
$wp_customize->add_section(
	'section_blog', array(
		'title'      => esc_html__( 'Blog Options', 'blorigan' ),
		'priority'   => 100,
		'capability' => 'edit_theme_options',
		'panel'      => 'theme_option_panel',
	)
);

// Setting excerpt_length.
$wp_customize->add_setting(
	'theme_options[excerpt_length]', array(
		'default'           => $default['excerpt_length'],
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'blorigan_sanitize_positive_integer',
	)
);
$wp_customize->add_control(
	'theme_options[excerpt_length]', array(
		'label'       => esc_html__( 'Excerpt Length', 'blorigan' ),
		'description' => esc_html__( 'in words', 'blorigan' ),
		'section'     => 'section_blog',
		'type'        => 'number',
		'priority'    => 100,
		'input_attrs' => array(
			'min'   => 1,
			'max'   => 200,
			'style' => 'width: 55px;',
		),
	)
);
// Setting read_more_text.
$wp_customize->add_setting(
	'theme_options[read_more_text]', array(
		'default'           => $default['read_more_text'],
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'theme_options[read_more_text]', array(
		'label'    => esc_html__( 'Read More Text', 'blorigan' ),
		'section'  => 'section_blog',
		'type'     => 'text',
		'priority' => 100,
	)
);

// Setting exclude_categories.
$wp_customize->add_setting(
	'theme_options[exclude_categories]', array(
		'default'           => $default['exclude_categories'],
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'sanitize_text_field',
	)
);
$wp_customize->add_control(
	'theme_options[exclude_categories]', array(
		'label'       => esc_html__( 'Exclude Categories in Blog', 'blorigan' ),
		'description' => esc_html__( 'Enter category ID to exclude in Blog Page. Separate with comma if more than one.', 'blorigan' ),
		'section'     => 'section_blog',
		'type'        => 'text',
		'priority'    => 100,
	)
);

// Author Bio Section.
$wp_customize->add_section(
	'section_author_bio', array(
		'title'       => esc_html__( 'Author Bio Options', 'blorigan' ),
		'description' => esc_html__( 'Author Box will be displayed in the single post article.', 'blorigan' ),
		'priority'    => 100,
		'capability'  => 'edit_theme_options',
		'panel'       => 'theme_option_panel',
	)
);
// Setting author_bio_in_single.
$wp_customize->add_setting(
	'theme_options[author_bio_in_single]', array(
		'default'           => $default['author_bio_in_single'],
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'blorigan_sanitize_checkbox',
	)
);
$wp_customize->add_control(
	'theme_options[author_bio_in_single]', array(
		'label'    => esc_html__( 'Show Author Bio', 'blorigan' ),
		'section'  => 'section_author_bio',
		'type'     => 'checkbox',
		'priority' => 100,
	)
);

// Related Posts Section.
$wp_customize->add_section(
	'section_related_posts', array(
		'title'      => esc_html__( 'Related Posts Options', 'blorigan' ),
		'priority'   => 100,
		'capability' => 'edit_theme_options',
		'panel'      => 'theme_option_panel',
	)
);

// Setting related_posts_status.
$wp_customize->add_setting(
	'theme_options[related_posts_status]', array(
		'default'           => $default['related_posts_status'],
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'blorigan_sanitize_checkbox',
	)
);
$wp_customize->add_control(
	'theme_options[related_posts_status]', array(
		'label'       => esc_html__( 'Enable Related Posts', 'blorigan' ),
		'description' => esc_html__( 'Related posts will be displayed in single blog post.', 'blorigan' ),
		'section'     => 'section_related_posts',
		'type'        => 'checkbox',
		'priority'    => 100,
	)
);

// Breadcrumb Section.
$wp_customize->add_section(
	'section_breadcrumb', array(
		'title'      => esc_html__( 'Breadcrumb Options', 'blorigan' ),
		'priority'   => 100,
		'capability' => 'edit_theme_options',
		'panel'      => 'theme_option_panel',
	)
);

// Setting breadcrumb_type.
$wp_customize->add_setting(
	'theme_options[breadcrumb_type]', array(
		'default'           => $default['breadcrumb_type'],
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'blorigan_sanitize_select',
	)
);
$wp_customize->add_control(
	'theme_options[breadcrumb_type]', array(
		'label'    => esc_html__( 'Breadcrumb Type', 'blorigan' ),
		'section'  => 'section_breadcrumb',
		'type'     => 'select',
		'choices'  => blorigan_get_breadcrumb_type_options(),
		'priority' => 100,
	)
);
