<?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', 'luzuk-premium' ),
		'panel' => 'lz_fitness_premium_home_panel',
     	//'priority' => '50',
	)
);
//ENABLE/DISABLE BLOG SECTION
$wp_customize->add_setting(
	'blog_section_disable',
	array(
		'sanitize_callback' => 'lz_fitness_sanitize_text',
		'default' => 'off'
	)
);
$wp_customize->add_control(
	new lz_fitness_Switch_Control(
		$wp_customize,
		'blog_section_disable',
		array(
			'settings'      => 'blog_section_disable',
			'section'       => 'lz_fitness_blog_section',
			'label'         => __( 'Disable Section', 'luzuk-premium' ),
			'on_off_label'  => array(
				'on' => __( 'Yes', 'luzuk-premium' ),
				'off' => __( 'No', 'luzuk-premium' )
			)   
		)
	)
);

backgroundManager($wp_customize, 'blog', 'lz_fitness_blog_section', $color='#fff', get_template_directory_uri().'/images/default-gray.png', 'img');

lzCustomLable($wp_customize, 'blogsection_padding', 'lz_fitness_blog_section', ' Section Padding Setting:');

$wp_customize->add_setting(
    'sectionblog_toppadding',
    array(
        'sanitize_callback' => 'lz_fitness_sanitize_text',
        'default'           => __( '3em', 'luzuk-premium' )
    )
);
$wp_customize->add_control(
    'sectionblog_toppadding',
    array(
        'settings'      => 'sectionblog_toppadding',
        'section'       => 'lz_fitness_blog_section',
        'type'          => 'text',
        'label'         => __( 'Section Top Padding', 'luzuk-premium' )
    )
);
$wp_customize->add_setting(
    'sectionblog_bottompadding',
    array(
        'sanitize_callback' => 'lz_fitness_sanitize_text',
        'default'           => __( '3em', 'luzuk-premium' )
    )
);
$wp_customize->add_control(
    'sectionblog_bottompadding',
    array(
        'settings'      => 'sectionblog_bottompadding',
        'section'       => 'lz_fitness_blog_section',
        'type'          => 'text',
        'label'         => __( 'Section Bottom Padding', 'luzuk-premium' )
    )
);
$wp_customize->add_setting(
    'sectionblog_leftpadding',
    array(
        'sanitize_callback' => 'lz_fitness_sanitize_text',
        'default'           => __( '0px', 'luzuk-premium' )
    )
);
$wp_customize->add_control(
    'sectionblog_leftpadding',
    array(
        'settings'      => 'sectionblog_leftpadding',
        'section'       => 'lz_fitness_blog_section',
        'type'          => 'text',
        'label'         => __( 'Section Left Padding', 'luzuk-premium' )
    )
);
$wp_customize->add_setting(
    'sectionblog_rightpadding',
    array(
        'sanitize_callback' => 'lz_fitness_sanitize_text',
        'default'           => __( '0px', 'luzuk-premium' )
    )
);
$wp_customize->add_control(
    'sectionblog_rightpadding',
    array(
        'settings'      => 'sectionblog_rightpadding',
        'section'       => 'lz_fitness_blog_section',
        'type'          => 'text',
        'label'         => __( 'Section Right Padding', 'luzuk-premium' )
    )
);


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

// Heading color
addColorPalatOption($wp_customize, 'lz_fitness_blog_HeadingColor', 'lz_fitness_blog_section', 'Heading color', $headingColor);
// 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', 'luzuk-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', 'luzuk-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', 'luzuk-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', 'luzuk-premium'),
    'section'  => 'lz_fitness_premium_blog_section',
    'type'     => 'radio',
    'choices'  => array(
        '0' => __('Excerpts','luzuk-premium'),
        '1' => __('Full Posts','luzuk-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', 'luzuk-premium'),
			'section' => 'lz_fitness_premium_blog_section',
			'settings' => 'lz_fitness_blog_categories',
			'choices' => $lz_fitness_cat
		)
	)
);



lzCustomLable($wp_customize, 'blog_lblbuttonabtdisplay', 'lz_fitness_blog_section', 'Blog Button Display & Text Setting:');

// to show & hide another button
$wp_customize->add_setting( 'blog_button_display' , array( 'default' => true, 'transport' => 'refresh', ) ); $wp_customize->add_control( 'blog_button_display', array( 'label' => 'Blog Button Display', 'section' => 'lz_fitness_blog_section', 'settings' => 'blog_button_display', 'type' => 'radio', 'choices' => array( 'show' => 'Show Button', 'hide' => 'Hide Button', ), ) ); 
// end to show & hide button


$wp_customize->add_setting(
    'blogbutn_text',
    array(
        'sanitize_callback' => 'lz_fitness_sanitize_text',
        'default'           => __( 'Read More', 'luzuk-premium' )
    )
);
$wp_customize->add_control(
    'blogbutn_text',
    array(
        'settings'      => 'blogbutn_text',
        'section'       => 'lz_fitness_blog_section',
        'type'          => 'text',
        'label'         => __( 'Blog Button Text', 'luzuk-premium' )
    )
);


addColorPalatOption($wp_customize, 'blog_postbtntextColor', 'lz_fitness_blog_section', 'Post button text color', '#fff');
addColorPalatOption($wp_customize, 'blog_postbtnbgColor', 'lz_fitness_blog_section', 'Post button background color', '#ea4444');
addColorPalatOption($wp_customize, 'blog_postbtntexthoverColor', 'lz_fitness_blog_section', 'Post button text hover color', '#ea4444');
addColorPalatOption($wp_customize, 'blog_postbtnbghoverColor', 'lz_fitness_blog_section', 'Post button background hover color', '#000');
