<?php
/**
 *	Basic Settings
 *  Background Image
 *  Homepage
 *  Archives
 *  Search Results Page
 *  Page Settings
 *  Single Post Settings
 *  404 Error Page
 */ 
function mohali_basic_settings_customize_register( $wp_customize ) {
	
	$wp_customize->add_panel(
		'mohali-basic-settings', array(
			'title'		=>	__('Basic Settings', 'mohali'),
			'priority'	=>	20
		)
	);
	
	//Homepage Settings
	$wp_customize->add_section(
		'mohali-homepage', array(
			'title'		=>	__('Homepage (Blog)', 'mohali'),
			'priority'	=>	10,
			'panel'		=>	'mohali-basic-settings'
		)
	);
	
	$wp_customize->add_setting(
		'mohali-latest-post-title', array(
			'default'		=>	__('Latest Story','mohali'),
			'sanitize_callback'	=>	'sanitize_text_field' 
		)
	);
	
	$wp_customize->add_control(
		'mohali-latest-post-title', array(
			  'type' => 'text',
			  'section'		=>	'mohali-homepage',
			  'label' => __( 'Latest Posts Heading','mohali' ),
			  'description' => __( 'The Heading of the Section which displays the latest posts on the homepage. Below all featured areas.','mohali' ),
			)	
	);
	
	$wp_customize->add_setting(
		'mohali-home-layout', array(
			'default' => 'style2',
			'sanitize_callback'	=>	'mohali_sanitize_fa_style'
		)
	);
		
	$wp_customize->add_control(
		new mohali_Image_Radio_Control($wp_customize, 
			'mohali-home-layout', array(
				'type' => 'radio',
				'label' => esc_html__('Latest Posts Style', 'mohali'),
				'section' => 'mohali-homepage',
				'settings' => 'mohali-home-layout',
				'input_attrs' => array('class' => 'blog_layout_chooser'),
				'choices' => array(
					'style1' => get_template_directory_uri() . '/inc/customizer/images/content-style1.png',
					'style2' => get_template_directory_uri() . '/inc/customizer/images/content-style2.png',
				)
			)
		)
	);
	
	$wp_customize->add_setting(
			'mohali-primary-width-home', array(
				'default'	=>	'right-sidebar',
				'sanitize_callback'	=>	'mohali_sanitize_sidebar_layout'
			)
		);
		
	$wp_customize->add_control(
		new mohali_Image_Radio_Control($wp_customize, 
			'mohali-primary-width-home', array(
				'type' => 'radio',
				'label' => esc_html__('Sidebar Layout', 'mohali'),
				'section' => 'mohali-homepage',
				'settings' => 'mohali-primary-width-home',
				'input_attrs' => array('class' => 'sidebar_layout_chooser'),
				'choices' => array(
					'no-sidebar' => get_template_directory_uri() . '/inc/customizer/images/sidebar-no.jpg',
					'right-sidebar' => get_template_directory_uri() . '/inc/customizer/images/sidebar-right.jpg',
					'right-sidebar-narrow' => get_template_directory_uri() . '/inc/customizer/images/sidebar-right-narrow.jpg',
					'no-sidebar-narrow-primary' => get_template_directory_uri() . '/inc/customizer/images/sidebar-no-narrow-primary.jpg',
				)
			)
		)
	);
	
	//Background Image
	$wp_customize->get_section('background_image')->panel = 'mohali-basic-settings';
	$wp_customize->get_section('background_image')->priority = 5;
	
	//Archives
	$wp_customize->add_section(
		'mohali-archives', array(
			'title'		=>	__('Archives (Category/Tags)', 'mohali'),
			'priority'	=>	10,
			'panel'		=>	'mohali-basic-settings'
		)
	);
	
	$wp_customize->add_setting('mohali-archive-message', array(
		'sanitize_callback'	=>	'sanitize_text_field' 
		)
	);
	
	
			
	$wp_customize->add_setting(
			'mohali-primary-width-archives', array(
				'default'	=>	'no-sidebar-narrow-primary',
				'sanitize_callback'	=>	'mohali_sanitize_sidebar_layout'
			)
		);
		
	$wp_customize->add_control(
		new mohali_Image_Radio_Control($wp_customize, 
			'mohali-primary-width-archives', array(
				'type' => 'radio',
				'label' => esc_html__('Sidebar Layout', 'mohali'),
				'section' => 'mohali-archives',
				'settings' => 'mohali-primary-width-archives',
				'input_attrs' => array('class' => 'sidebar_layout_chooser'),
				'choices' => array(
					'no-sidebar' => get_template_directory_uri() . '/inc/customizer/images/sidebar-no.jpg',
					'right-sidebar' => get_template_directory_uri() . '/inc/customizer/images/sidebar-right.jpg',
					'right-sidebar-narrow' => get_template_directory_uri() . '/inc/customizer/images/sidebar-right-narrow.jpg',
					'no-sidebar-narrow-primary' => get_template_directory_uri() . '/inc/customizer/images/sidebar-no-narrow-primary.jpg',
				)
			)
		)
	);
		
	//Page Settings.
	$wp_customize->add_section(
		'mohali-page-settings', array(
			'title'		=>	__('Pages', 'mohali'),
			'priority'	=>	10,
			'panel'		=>	'mohali-basic-settings'
		)
	);
	
	$wp_customize->add_setting('mohali-page-message', array(
		'sanitize_callback'	=>	'sanitize_text_field' 
		)
	);
	
	$wp_customize->add_control(
		new mohali_Custom_Notice_Control(
			$wp_customize, 'mohali-page-message', array(
				'label'		=>	__('Page Settings', 'mohali'),
				'description'	=>	__('Use this section to customize the layout of pages of your site.', 'mohali'),
				'priority'		=>	1,
				'section'		=>	'mohali-page-settings',
			)
		)
	);
	
	$wp_customize->add_setting(
		'mohali-primary-width-page', array(
				'default'	=>	'no-sidebar-narrow-primary',
				'sanitize_callback'	=>	'mohali_sanitize_sidebar_layout'
			)
		);
		
	$wp_customize->add_control(
		new mohali_Image_Radio_Control($wp_customize, 
			'mohali-primary-width-page', array(
				'type' => 'radio',
				'label' => esc_html__('Sidebar Layout', 'mohali'),
				'section' => 'mohali-page-settings',
				'settings' => 'mohali-primary-width-page',
				'input_attrs' => array('class' => 'sidebar_layout_chooser'),
				'choices' => array(
					'no-sidebar' => get_template_directory_uri() . '/inc/customizer/images/sidebar-no.jpg',
					'right-sidebar' => get_template_directory_uri() . '/inc/customizer/images/sidebar-right.jpg',
					'right-sidebar-narrow' => get_template_directory_uri() . '/inc/customizer/images/sidebar-right-narrow.jpg',
					'no-sidebar-narrow-primary' => get_template_directory_uri() . '/inc/customizer/images/sidebar-no-narrow-primary.jpg',
				)
			)
		)
	);
	
	//Single Post Settings.
	$wp_customize->add_section(
		'mohali-single-post', array(
			'title'		=>	__('Single Posts', 'mohali'),
			'priority'	=>	10,
			'panel'		=>	'mohali-basic-settings'
		)
	);
	
	$wp_customize->add_setting('mohali-single-post-message', array(
		'sanitize_callback'	=>	'sanitize_text_field' 
		)
	);
	
	$wp_customize->add_control(
		new mohali_Custom_Notice_Control(
			$wp_customize, 'mohali-single-post-message', array(
				'label'		=>	__('Single Post Settings', 'mohali'),
				'description'	=>	__('Use this section to customize the layout of Single Posts. Navigate to one of the published posts to view changes on the right side.', 'mohali'),
				'priority'		=>	1,
				'section'		=>	'mohali-single-post',
			)
		)
	);
	
	$wp_customize->add_setting(
		'mohali-primary-width-single-post', array(
				'default'	=>	'no-sidebar-narrow-primary',
				'sanitize_callback'	=>	'mohali_sanitize_sidebar_layout'
			)
		);
		
	$wp_customize->add_control(
		new mohali_Image_Radio_Control($wp_customize, 
			'mohali-primary-width-single-post', array(
				'type' => 'radio',
				'label' => esc_html__('Sidebar Layout', 'mohali'),
				'section' => 'mohali-single-post',
				'settings' => 'mohali-primary-width-single-post',
				'input_attrs' => array('class' => 'sidebar_layout_chooser'),
				'choices' => array(
					'no-sidebar' => get_template_directory_uri() . '/inc/customizer/images/sidebar-no.jpg',
					'right-sidebar' => get_template_directory_uri() . '/inc/customizer/images/sidebar-right.jpg',
					'right-sidebar-narrow' => get_template_directory_uri() . '/inc/customizer/images/sidebar-right-narrow.jpg',
					'no-sidebar-narrow-primary' => get_template_directory_uri() . '/inc/customizer/images/sidebar-no-narrow-primary.jpg',
				)
			)
		)
	);	
	
	//Search Results Page
	$wp_customize->add_section(
		'mohali-search-results', array(
			'title'		=>	__('Search Results Page', 'mohali'),
			'priority'	=>	10,
			'panel'		=>	'mohali-basic-settings'
		)
	);
	
	$wp_customize->add_setting('mohali-search-results-message', array(
		'sanitize_callback'	=>	'sanitize_text_field' 
		)
	);

	$wp_customize->add_setting(
		'mohali-primary-width-search', array(
			'default'	=>	'no-sidebar-narrow-primary',
			'sanitize_callback'	=>	'mohali_sanitize_sidebar_layout'
		)
	);
	
	$wp_customize->add_control(
		new mohali_Image_Radio_Control($wp_customize, 
			'mohali-primary-width-search', array(
				'type' => 'radio',
				'label' => esc_html__('Sidebar Layout', 'mohali'),
				'section' => 'mohali-search-results',
				'settings' => 'mohali-primary-width-search',
				'input_attrs' => array('class' => 'sidebar_layout_chooser'),
				'choices' => array(
					'no-sidebar' => get_template_directory_uri() . '/inc/customizer/images/sidebar-no.jpg',
					'right-sidebar' => get_template_directory_uri() . '/inc/customizer/images/sidebar-right.jpg',
					'right-sidebar-narrow' => get_template_directory_uri() . '/inc/customizer/images/sidebar-right-narrow.jpg',
					'no-sidebar-narrow-primary' => get_template_directory_uri() . '/inc/customizer/images/sidebar-no-narrow-primary.jpg',
				)
			)
		)
	);
	
	//404 Error Page Settings.
	$wp_customize->add_section(
		'mohali-404-error', array(
			'title'		=>	__('404 Error Page', 'mohali'),
			'priority'	=>	10,
			'panel'		=>	'mohali-basic-settings'
		)
	);
	
	$wp_customize->add_setting('mohali-404page-message', array(
		'sanitize_callback'	=>	'sanitize_text_field' 
		)
	);
	
	$wp_customize->add_control(
		new mohali_Custom_Notice_Control(
			$wp_customize, 'mohali-404page-message', array(
				'label'		=>	__('404 Page', 'mohali'),
				'description'	=>	__('Use this page to customize the 404 Error Page.', 'mohali'),
				'priority'		=>	1,
				'section'		=>	'mohali-404-error',
			)
		)
	);
	
	$wp_customize->add_setting(
		'mohali-enable-404-posts', array(
			'default'		=>	1,
			'sanitize_callback'	=>	'absint' 
		)
	);
		
	$wp_customize->add_control(
		'mohali-enable-404-posts', array(
			  'type' => 'checkbox',
			  'section'		=>	'mohali-404-error',
			  'label' => __( 'Show Latest Posts on 404 Page','mohali' ),
			)	
	);
	
	
	
}
add_action('customize_register', 'mohali_basic_settings_customize_register');