<?php
/**
 * Createing a bog pannel for customizer
 *
 *
 */
$lz_fitness_categories = get_categories(array('hide_empty' => 0));
foreach ($lz_fitness_categories as $lz_fitness_category) {
	$lz_fitness_cat[$lz_fitness_category->term_id] = $lz_fitness_category->cat_name;
}
/****************************/
// START BLOG SECTION FOR HOME PAGE
/*============BLOG PANEL============*/
$wp_customize->add_section(
	'lz_fitness_blog_section',
	array(
		'title' => __( 'Blog Section', 'lz-fitness-premium' ),
		'panel' => 'lz_fitness_premium_home_panel',
     	//'priority' => '50',
	)
);
//ENABLE/DISABLE BLOG SECTION
$wp_customize->add_setting(
	'lz_fitness_blog_section_disable',
	array(
		'sanitize_callback' => 'lz_fitness_sanitize_text',
		'default' => 'off'
	)
);
$wp_customize->add_control(
	new lz_fitness_Switch_Control(
		$wp_customize,
		'lz_fitness_blog_section_disable',
		array(
			'settings'      => 'lz_fitness_blog_section_disable',
			'section'       => 'lz_fitness_blog_section',
			'label'         => __( 'Disable Section', 'lz-fitness-premium' ),
			'on_off_label'  => array(
				'on' => __( 'Yes', 'lz-fitness-premium' ),
				'off' => __( 'No', 'lz-fitness-premium' )
			)   
		)
	)
);

backgroundManager($wp_customize, 'blog', 'lz_fitness_blog_section', $color='#fff');

$wp_customize->add_setting(
	'lz_fitness_blog_title_subtitle_heading',
	array(
		'sanitize_callback' => 'lz_fitness_sanitize_text'
	)
);
$wp_customize->add_control(
	new lz_fitness_Customize_Heading(
		$wp_customize,
		'lz_fitness_blog_title_subtitle_heading',
		array(
			'settings'      => 'lz_fitness_blog_title_subtitle_heading',
			'section'       => 'lz_fitness_blog_section',
			'label'         => __( 'Section Title & Sub Title', 'lz-fitness-premium' ),
		)
	)
);
$wp_customize->add_setting(
	'lz_fitness_blog_title',
	array(
		'sanitize_callback' => 'lz_fitness_sanitize_text',
		'default'           => __( 'Blog Section', 'lz-fitness-premium' )
	)
);
$wp_customize->add_control(
	'lz_fitness_blog_title',
	array(
		'settings'      => 'lz_fitness_blog_title',
		'section'       => 'lz_fitness_blog_section',
		'type'          => 'text',
		'label'         => __( 'Title', 'lz-fitness-premium' )
	)
);
$wp_customize->add_setting(
	'lz_fitness_blog_sub_title',
	array(
		'sanitize_callback' => 'lz_fitness_sanitize_text',
		'default'           => __( 'Here goes the short description for the section', 'lz-fitness-premium' )
	)
);
$wp_customize->add_control(
	'lz_fitness_blog_sub_title',
	array(
		'settings'      => 'lz_fitness_blog_sub_title',
		'section'       => 'lz_fitness_blog_section',
		'type'          => 'textarea',
		'label'         => __( 'Sub Title', 'lz-fitness-premium' )
	)
);

// Heading color
addColorPalatOption($wp_customize, 'lz_fitness_blog_HeadingColor', 'lz_fitness_blog_section', 'Heading color', '#2b2b2b');
// Subheading color
addColorPalatOption($wp_customize, 'lz_fitness_blog_SubheadingColor', 'lz_fitness_blog_section', 'Subheading color', '#424242');
// Title color
addColorPalatOption($wp_customize, 'lz_fitness_blog_TitleColor', 'lz_fitness_blog_section', 'Title color', '#444');
// Text color
addColorPalatOption($wp_customize, 'lz_fitness_blog_TextColor', 'lz_fitness_blog_section', 'Text color', '#333333');


//BLOG SETTINGS
$wp_customize->add_setting(
	'lz_fitness_blog_post_count',
	array(
		'default'           => '3',
		'sanitize_callback' => 'lz_fitness_sanitize_choices'
	)
);
$wp_customize->add_control(
	new lz_fitness_Dropdown_Chooser(
		$wp_customize,
		'lz_fitness_blog_post_count',
		array(
			'settings'      => 'lz_fitness_blog_post_count',
			'section'       => 'lz_fitness_blog_section',
			'label'         => __( 'Number of Posts to show', 'lz-fitness-premium' ),
			'choices'       => $lz_fitness_post_count_choice
		)
	)
);
$wp_customize->add_setting(
	'lz_fitness_blog_cat_exclude',
	array(
		'sanitize_callback' => 'lz_fitness_sanitize_text'
	)
);
$wp_customize->add_control(
	new lz_fitness_Customize_Checkbox_Multiple(
		$wp_customize,
		'lz_fitness_blog_cat_exclude',
		array(
			'label' => __('Exclude Category from Blog Posts', 'lz-fitness-premium'),
			'section' => 'lz_fitness_blog_section',
			'settings' => 'lz_fitness_blog_cat_exclude',
			'choices' => $lz_fitness_cat
		)
	)
);
// END BLOG SECTION FOR HOME PAGE
/****************************/


// CREATING A BLOG SECTION IN CUSTOMIZER FOR BLOG PAGES
$wp_customize->add_section(
	'lz_fitness_premium_blog_section',
	array(
		'title' => __( 'Blog Page Settings', 'lz-fitness-premium' ),
        // 'panel' => 'lz_fitness_premium_home_panel'
		'priority' =>19
	)
);


$wp_customize->add_setting('lz_fitness_blog_categories_settings', array('sanitize_callback' => 'lz_fitness_sanitize_text'));
$wp_customize->add_control('lz_fitness_blog_categories_settings', array(
    'settings' => 'lz_fitness_blog_categories_settings',
    'label'    => __('Posts on Blog Page', 'lz-fitness-premium'),
    'section'  => 'lz_fitness_premium_blog_section',
    'type'     => 'radio',
    'choices'  => array(
        '0' => __('Excerpts','lz-fitness-premium'),
        '1' => __('Full Posts','lz-fitness-premium'),
    ),
));
// ADDING THE CATEGORY TO SELECT
$wp_customize->add_setting('lz_fitness_blog_categories', array('sanitize_callback' => 'lz_fitness_sanitize_text'));
$wp_customize->add_control(
	new lz_fitness_Customize_Checkbox_Multiple(
		$wp_customize,
		'lz_fitness_blog_categories',
		array(
			'label' => __('Exclude Category from Blog Posts', 'lz-fitness-premium'),
			'section' => 'lz_fitness_premium_blog_section',
			'settings' => 'lz_fitness_blog_categories',
			'choices' => $lz_fitness_cat
		)
	)
);
