<?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', 'supermarket-ecommerce' ),
		'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', 'supermarket-ecommerce' ),
			'on_off_label'  => array(
				'on' => __( 'Yes', 'supermarket-ecommerce' ),
				'off' => __( 'No', 'supermarket-ecommerce' )
			)   
		)
	)
);

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', 'supermarket-ecommerce' ),
		)
	)
);
$wp_customize->add_setting(
	'lz_fitness_blog_title',
	array(
		'sanitize_callback' => 'lz_fitness_sanitize_text',
		'default'           => __( 'Blog Section', 'supermarket-ecommerce' )
	)
);
$wp_customize->add_control(
	'lz_fitness_blog_title',
	array(
		'settings'      => 'lz_fitness_blog_title',
		'section'       => 'lz_fitness_blog_section',
		'type'          => 'text',
		'label'         => __( 'Title', 'supermarket-ecommerce' )
	)
);
$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', 'supermarket-ecommerce' )
	)
);
$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', 'supermarket-ecommerce' )
	)
);

// 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', 'supermarket-ecommerce' ),
			'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', 'supermarket-ecommerce'),
			'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', 'supermarket-ecommerce' ),
        // 'panel' => 'lz_fitness_premium_home_panel'
		'priority' =>19
	)
);
// ENABLE/DISABLE FEATURED SECTION
/*$wp_customize->add_setting(
	'lz_fitness_premium_blog_section_disable',
	array(
		'sanitize_callback' => 'lz_fitness_sanitize_text',
	)
);
$wp_customize->add_control(
	new lz_fitness_Switch_Control(
		$wp_customize,
		'lz_fitness_premium_blog_section_disable',
		array(
			'settings'      => 'lz_fitness_premium_blog_section_disable',
			'section'       => 'lz_fitness_premium_blog_section',
			'label'         => __( 'Show Title and description at top', 'supermarket-ecommerce' ),
			'on_off_label'  => array(
				'on' => __( 'Yes', 'supermarket-ecommerce' ),
				'off' => __( 'No', 'supermarket-ecommerce' )
			),
		)
	)
);*/
/*
$wp_customize->add_setting(
	'lz_fitness_blog_title_heading',
	array(
		'sanitize_callback' => 'lz_fitness_sanitize_text'
	)
);
$wp_customize->add_control(
	new lz_fitness_Customize_Heading(
		$wp_customize,
		'lz_fitness_blog_title_heading',
		array(
			'settings'      => 'lz_fitness_blog_title_heading',
			'section'       => 'lz_fitness_premium_blog_section',
			'label'         => __( 'Blog Title & description', 'supermarket-ecommerce' ),
		)
	)
);
//BLOG PAGE TITLE
$wp_customize->add_setting('lz_fitness_blog_title', array('sanitize_callback' => 'lz_fitness_sanitize_text'));
$wp_customize->add_control('lz_fitness_blog_title', array('settings'=>'lz_fitness_blog_title', 'section'=>'lz_fitness_premium_blog_section','type'=>'text', 'label'=> __('Blog page title', 'supermarket-ecommerce')));
// BLOG PAGE DESCRIPTION
$wp_customize->add_setting('lz_fitness_blog_desc', array('sanitize_callback' => 'lz_fitness_sanitize_text'));
$wp_customize->add_control('lz_fitness_blog_desc', array('settings'=>'lz_fitness_blog_desc', 'section'=>'lz_fitness_premium_blog_section','type'=>'textarea', 'label'=> __('Blog page description', 'supermarket-ecommerce')));*/

$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', 'supermarket-ecommerce'),
    'section'  => 'lz_fitness_premium_blog_section',
    'type'     => 'radio',
    'choices'  => array(
        '0' => __('Excerpts','supermarket-ecommerce'),
        '1' => __('Full Posts','supermarket-ecommerce'),
    ),
));
// 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', 'supermarket-ecommerce'),
			'section' => 'lz_fitness_premium_blog_section',
			'settings' => 'lz_fitness_blog_categories',
			'choices' => $lz_fitness_cat
		)
	)
);



