<?php
function tribute_themes_customizer($wp_customize) {
	$tribute_cat_array = array('');
	$get_categories=get_categories();
	if ($get_categories) {
		$tribute_cat_array[] = '';
		foreach ( $get_categories as $get_categoriesvalues ) {
			$tribute_cat_array[$get_categoriesvalues->term_id] = $get_categoriesvalues->name;
		}
	} else {
		$tribute_cat_array["No content blocks found"] = 0;
	}
	require get_template_directory() . '/admin/tribute-customizerclass.php';
	$wp_customize->add_panel(
    'theme_setting_section',
    array(
        'title' => __('Themes Settings', 'tribute'),
		 'theme_supports' => '',
		 'capability'     => 'edit_theme_options',
        'priority' => 35,
    )
);
$wp_customize->add_section(
    'frontpage_banner_slider',
    array(
        'title' => __( 'Front placement', 'tribute'),
        'priority' => 1,
		'panel'       => 'theme_setting_section',
    )
);

$wp_customize->add_setting(
'front_placement',
array(
				'default' => '',
				'sanitize_callback' => 'sanitize_text_field',
				'transport'   => 'refresh',

			)
);
$wp_customize->add_control(
		new tribute_Custom_Radio_Image_Control( 
			// $wp_customize object
			$wp_customize,
			// $id
			'front_placement',
			// $args
			array(
				'settings'		=> 'front_placement',
				'section'		=> 'frontpage_banner_slider',
				'description'	=> esc_html__( 'Front placement', 'tribute' ),
				'choices'		=> array(
				'banner' => array(
                        'label' => esc_html__( 'Banner', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/home-banner.jpg',
                    ),
					'slider' => array(
                        'label' => esc_html__( 'Slider', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/slider.jpg',
                    ),
					
				)
			)
		)
	);
$wp_customize->add_section(
    'footer_style_settings',
    array(
        'title' => __( 'Footer style', 'tribute'),
        'priority' => 1,
		'panel'       => 'theme_setting_section',
    )
); 
$wp_customize->add_control(
		new tribute_Custom_Radio_Image_Control( 
			// $wp_customize object
			$wp_customize,
			// $id
			'footer_var_style',
			// $args
			array(
				'settings'		=> 'footer_var_style',
				'section'		=> 'footer_style_settings',
				'description'	=> esc_html__( 'Blog sidebar', 'tribute' ),
				'choices'		=> array(
				'left_blog' => array(
                        'label' => esc_html__( 'Left sidebar', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/blog-left-sidebar.jpg',
                    ),
					'right_blog' => array(
                        'label' => esc_html__( 'Right sidebar', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/blog-right-sidebar.jpg',
                    ),
					'full_blog' => array(
                        'label' => esc_html__( 'Full width', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/blog-full-width.jpg',
                    ),
					
				)
			)
		)
	);
$wp_customize->add_section(
    'footer_settings',
    array(
        'title' => __( 'Footer settings', 'tribute'),
        'priority' => 1,
		'panel'       => 'theme_setting_section',
    )
);
$wp_customize->add_setting(
'hide_copyright', array(
				'default' => '',
				'sanitize_callback' => 'sanitize_text_field',
				'transport'   => 'refresh',

			)
);

$wp_customize->add_control(
'hide_copyright',
array(
    'type' => 'checkbox',
    'label' =>__('Hide copyright text', 'tribute'),
    'section' => 'footer_settings',
)
);
$wp_customize->add_setting(
'copyright_textbox',
array(
				'default' => '',
				'sanitize_callback' => 'sanitize_text_field',
				'transport'   => 'refresh',

			)
);
$wp_customize->add_control(
'copyright_textbox',
array(
    'label' =>__('Copyright text', 'tribute'),
    'section' => 'footer_settings',
    'type' => 'textarea',
)
);
//start footer style
$wp_customize->add_setting(
'footer_icon_style',
array(
				'default' => '',
				'sanitize_callback' => 'sanitize_text_field',
				'transport'   => 'refresh',

			)
);
$wp_customize->add_control(
		new tribute_Custom_Radio_Image_Control( 
			// $wp_customize object
			$wp_customize,
			// $id
			'footer_icon_style',
			// $args
			array(
				'settings'		=> 'footer_icon_style',
				'section'		=> 'footer_settings',
				'description'	=> esc_html__( 'Footer logo & Icon style', 'tribute' ),
				'choices'		=> array(
				'footer_icon_a' => array(
                        'label' => esc_html__( 'Copyright/Social icon', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/copyright-icon.jpg',
                    ),
					'footer_icon_b' => array(
                        'label' => esc_html__( 'Social icon/Copyright', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/icon-copyright.jpg',
                    ),
					'footer_icon_c' => array(
                        'label' => esc_html__( 'Left copyright', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/leftcopyright.jpg',
                    ),
					'footer_icon_d' => array(
                        'label' => esc_html__( 'Right copyright', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/rightcopyright.jpg',
                    ),
					'footer_icon_e' => array(
                        'label' => esc_html__( 'Left social icon', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/lefticon.jpg',
                    ),
					'footer_icon_f' => array(
                        'label' => esc_html__( 'Right social icon', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/footer-righticon.jpg',
                    ),
					'footer_icon_g' => array(
                        'label' => esc_html__( 'Center copyright', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/footer-center-copyright.jpg',
                    ),
					'footer_icon_h' => array(
                        'label' => esc_html__( 'Center social icon', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/footer-center-icon.jpg',
                    ),
					
				)
			)
		)
	);
		//Typography
	$wp_customize->add_section(
   'typography_settings',
   array(
       'title' => esc_html__('Typography', 'tribute'),
       'priority' => 1,
	   'panel'       => 'theme_setting_section',
   )
);
$wp_customize->add_setting(
'heading_h1',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
'transport'=> 'refresh',));

$wp_customize->add_control( new tribute_Customizer_Range_Value_Control( $wp_customize, 'heading_h1', array(
	'type'     => 'range-value',
	'section'  => 'typography_settings',
	'settings' => 'heading_h1',
	'label'    => esc_html__( 'H1 font size','tribute' ),
	'input_attrs' => array(
		'min'    => 1,
		'max'    => 70,
		'step'   => 1,
		'suffix' => 'px', //optional suffix
  	),
) ) );
//h2
$wp_customize->add_setting(
'heading_h2',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
'transport'=> 'refresh',));

$wp_customize->add_control( new tribute_Customizer_Range_Value_Control( $wp_customize, 'heading_h2', array(
	'type'     => 'range-value',
	'section'  => 'typography_settings',
	'settings' => 'heading_h2',
	'label'    => esc_html__( 'H2 font size','tribute' ),
	'input_attrs' => array(
		'min'    => 1,
		'max'    => 70,
		'step'   => 1,
		'suffix' => 'px', //optional suffix
  	),
) ) );
$wp_customize->add_setting(
'heading_h3',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
'transport'=> 'refresh',));

$wp_customize->add_control( new tribute_Customizer_Range_Value_Control( $wp_customize, 'heading_h3', array(
	'type'     => 'range-value',
	'section'  => 'typography_settings',
	'settings' => 'heading_h3',
	'label'    => esc_html__( 'H3 font size','tribute' ),
	'input_attrs' => array(
		'min'    => 1,
		'max'    => 70,
		'step'   => 1,
		'suffix' => 'px', //optional suffix
  	),
) ) );
$wp_customize->add_setting(
'heading_h4',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
'transport'=> 'refresh',));

$wp_customize->add_control( new tribute_Customizer_Range_Value_Control( $wp_customize, 'heading_h4', array(
	'type'     => 'range-value',
	'section'  => 'typography_settings',
	'settings' => 'heading_h4',
	'label'    => esc_html__( 'H4 font size','tribute' ),
	'input_attrs' => array(
		'min'    => 1,
		'max'    => 70,
		'step'   => 1,
		'suffix' => 'px', //optional suffix
  	),
) ) );

$wp_customize->add_setting(
'heading_h5',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
'transport'=> 'refresh',));

$wp_customize->add_control( new tribute_Customizer_Range_Value_Control( $wp_customize, 'heading_h5', array(
	'type'     => 'range-value',
	'section'  => 'typography_settings',
	'settings' => 'heading_h5',
	'label'    => esc_html__( 'H5 font size','tribute' ),
	'input_attrs' => array(
		'min'    => 1,
		'max'    => 70,
		'step'   => 1,
		'suffix' => 'px', //optional suffix
  	),
) ) );
$wp_customize->add_setting(
'heading_h6',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
'transport'=> 'refresh',));

$wp_customize->add_control( new tribute_Customizer_Range_Value_Control( $wp_customize, 'heading_h6', array(
	'type'     => 'range-value',
	'section'  => 'typography_settings',
	'settings' => 'heading_h6',
	'label'    => esc_html__( 'H6 font size','tribute' ),
	'input_attrs' => array(
		'min'    => 1,
		'max'    => 70,
		'step'   => 1,
		'suffix' => 'px', //optional suffix
  	),
) ) );

//end
//show
$wp_customize->add_setting(
'hide_topicon', array(
				'default' => '',
				'sanitize_callback' => 'sanitize_text_field',
				'transport'   => 'refresh',

			)
);
$wp_customize->add_section(
    'hide_topicon_settings',
    array(
        'title' => __( 'Top header icon', 'tribute'),
        'priority' => 1,
		'panel'       => 'theme_setting_section',
    )
);
$wp_customize->add_control(
'hide_topicon',
array(
    'type' => 'checkbox',
    'label' =>__('Show top social icon', 'tribute'),
    'section' => 'hide_topicon_settings',
)
);

$wp_customize->add_setting(
'logo_placement',
array(
				'default' => '',
				'sanitize_callback' => 'sanitize_text_field',
				'transport'   => 'refresh',

			)
);
$wp_customize->add_section(
    'logo_placement_settings',
    array(
        'title' => __( 'Logo Placement', 'tribute'),
        'priority' => 1,
		'panel'       => 'theme_setting_section',
    )
); 
$wp_customize->add_control(
		new tribute_Custom_Radio_Image_Control( 
			// $wp_customize object
			$wp_customize,
			// $id
			'logo_placement',
			// $args
			array(
				'settings'		=> 'logo_placement',
				'section'		=> 'logo_placement_settings',
				'description'	=> esc_html__( 'Logo placement', 'tribute' ),
				'choices'		=> array(
				'left' => array(
                        'label' => esc_html__( 'Left', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/left-logo.jpg',
                    ),
					'right' => array(
                        'label' => esc_html__( 'Right', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/right-logo.jpg',
                    ),
					'center' => array(
                        'label' => esc_html__( 'Center', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/center-logo.jpg',
                    ),
					
				)
			)
		)
	);
$wp_customize->add_section(
    'theme_color_settings',
    array(
        'title' => __( 'Color settings', 'tribute'),
        'priority' => 1,
		'panel'       => 'theme_setting_section',
    )
); 
$wp_customize->add_setting(
'color-setting',
array(
    'default' => '#da4453',
    'sanitize_callback' => 'sanitize_hex_color',
)
);

$wp_customize->add_control(
new WP_Customize_Color_Control(
    $wp_customize,
    'color-setting',
    array(
        'label' =>__('Theme Color Setting', 'tribute'),
        'section' => 'theme_color_settings',
        'settings' => 'color-setting',
    )
)
);

$wp_customize->add_setting(
'bgcolor-setting',
array(
    'default' => '',
    'sanitize_callback' => 'sanitize_hex_color',
)
);

$wp_customize->add_control(
new WP_Customize_Color_Control(
    $wp_customize,
    'bgcolor-setting',
    array(
        'label' =>__('Background Color Setting', 'tribute'),
        'section' => 'theme_color_settings',
        'settings' => 'bgcolor-setting',
    )
)
);

$wp_customize->add_setting('bgimg-upload',array(
				'default' => '',
				'sanitize_callback' => 'esc_url_raw',
				'transport'   => 'refresh',

			) );
 
$wp_customize->add_control(
new WP_Customize_Upload_Control(
    $wp_customize,
    'bgimg-upload',
    array(
        'label' =>__('Banner Image Change', 'tribute'),
        'section' => 'frontpage_banner_slider',
        'settings' => 'bgimg-upload'
    )
)
);




$wp_customize->add_setting(
'banner_title',array(
				'default' => 'Free Responsive WordPress Theme',
				'sanitize_callback' => 'sanitize_text_field',
				'transport'   => 'refresh',
			)
);
$wp_customize->add_control(
'banner_title',
array(
    'type' => 'text',
    'label' =>__('Banner Title', 'tribute'),
    'section' => 'frontpage_banner_slider',
)
);

$wp_customize->add_setting(
'banner_text',array(
				'default' => 'Tribute is a free WordPress theme for blogs that are designed to have beautiful typography.',
				'sanitize_callback' => 'sanitize_text_field',
				'transport'   => 'refresh',

			)
);

$wp_customize->add_control(
'banner_text',
array(
    'type' => 'textarea',
    'label' =>__('Banner Text', 'tribute'),
    'section' => 'frontpage_banner_slider',
)
);
//Blog Section
$wp_customize->add_section(
    'blog_section',
    array(
        'title' => __( 'Blog Sidebar Section ', 'tribute'),
        'priority' => 10,
		'panel'       => 'theme_setting_section',
    )
);
$wp_customize->add_setting(
'choose-option-blog',
array(
				'default' => 'left_blog',
				'sanitize_callback' => 'sanitize_text_field',
				'transport'   => 'refresh',

			)
);
$wp_customize->add_control(
		new tribute_Custom_Radio_Image_Control( 
			// $wp_customize object
			$wp_customize,
			// $id
			'choose-option-blog',
			// $args
			array(
				'settings'		=> 'choose-option-blog',
				'section'		=> 'blog_section',
				'description'	=> esc_html__( 'Blog sidebar', 'tribute' ),
				'choices'		=> array(
				'left_blog' => array(
                        'label' => esc_html__( 'Left sidebar', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/blog-left-sidebar.jpg',
                    ),
					'right_blog' => array(
                        'label' => esc_html__( 'Right sidebar', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/blog-right-sidebar.jpg',
                    ),
					'full_blog' => array(
                        'label' => esc_html__( 'Full width', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/blog-full-width.jpg',
                    ),
					
				)
			)
		)
	);
//
$wp_customize->add_setting(
'choose-option-singleblog',
array(
				'default' => 'left_blog',
				'sanitize_callback' => 'sanitize_text_field',
				'transport'   => 'refresh',

			)
);
$wp_customize->add_control(
		new tribute_Custom_Radio_Image_Control( 
			// $wp_customize object
			$wp_customize,
			// $id
			'choose-option-singleblog',
			// $args
			array(
				'settings'		=> 'choose-option-singleblog',
				'section'		=> 'blog_section',
				'description'	=> esc_html__( 'Single post sidebar', 'tribute' ),
				'choices'		=> array(
				'left_blog' => array(
                        'label' => esc_html__( 'Left sidebar', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/blog-left-sidebar.jpg',
                    ),
					'right_blog' => array(
                        'label' => esc_html__( 'Right sidebar', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/blog-right-sidebar.jpg',
                    ),
					'full_blog' => array(
                        'label' => esc_html__( 'Full width', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/blog-full-width.jpg',
                    ),
					
				)
			)
		)
	);
//	template home	
$wp_customize->add_setting(
'choose_templatehome_sidebar',
array(
				'default' => 'left_blog',
				'sanitize_callback' => 'sanitize_text_field',
				'transport'   => 'refresh',

			)
);
$wp_customize->add_control(
		new tribute_Custom_Radio_Image_Control( 
			// $wp_customize object
			$wp_customize,
			// $id
			'choose_templatehome_sidebar',
			// $args
			array(
				'settings'		=> 'choose_templatehome_sidebar',
				'section'		=> 'blog_section',
				'description'	=> esc_html__( 'Template home sidebar settings', 'tribute' ),
				'choices'		=> array(
				'left_blog' => array(
                        'label' => esc_html__( 'Left Sidebar', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/blog-left-sidebar.jpg',
                    ),
					'right_blog' => array(
                        'label' => esc_html__( 'Right Sidebar', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/blog-right-sidebar.jpg',
                    ),
					'full_blog' => array(
                        'label' => esc_html__( 'Full width', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/blog-full-width.jpg',
                    ),
					'gridleft_blog' => array(
                        'label' => esc_html__( 'Grid left sidebar', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/grid-with-left-sidebar.jpg',
                    ),
					'gridright_blog' => array(
                        'label' => esc_html__( 'Grid right sidebar', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/grid-with-right-sidebar.jpg',
                    ),
					'gridfull_blog' => array(
                        'label' => esc_html__( 'Grid Full width', 'tribute' ),
                        'url'   => get_template_directory_uri() . '/images/grid-full-width.jpg',
                    ),
					
				)
			)
		)
	);

// Slide Image 03
$wp_customize->add_setting(
'slider_category',array(
				'default' => '',
				'sanitize_callback' => 'sanitize_text_field',
				'transport'   => 'refresh',
			)
);
$wp_customize->add_control(
'slider_category',
array(
    'type' => 'select',
    'label' =>__('Slider Category', 'tribute'),
	'choices' =>$tribute_cat_array,
	'section' => 'frontpage_banner_slider',
)
);
$wp_customize->add_section(
   'subbg_color_settings',
   array(
       'title' => esc_html__('Submenu background color', 'tribute'),
       'priority' => 20,
	   'panel'       => 'theme_setting_section',
   )
);
$wp_customize->add_setting( 'submenu_bg' , array(
    'default'     => '',
    'transport'   => 'refresh',
    'sanitize_callback' => 'sanitize_text_field',
) );

$wp_customize->add_control(
  new WP_Customize_Color_Control( $wp_customize, 'submenu_bg',
  array(
    'label' => __( 'Color Setting','tribute' ),
    'description' =>'',
    'section' => 'subbg_color_settings', // Add a default or your own section
) ) );

}
add_action('customize_register', 'tribute_themes_customizer');




function tribute_customizer_social_media_array() {
 
	/* store social site names in array */
	$social_sites = array( 'facebook','twitter', 'linkedin', 'instagram','google-plus', 'flickr', 'pinterest', 'youtube', 'tumblr', 'dribbble', 'rss',  'email');
 
	return $social_sites;
}
/* add settings to create various social media text areas. */
add_action('customize_register', 'tribute_add_social_sites_customizer');
function tribute_add_social_sites_customizer($wp_customize) {
	$wp_customize->add_section('my_social_settings', array(
			'title'    => __('Social Media Icons', 'tribute'),
			'priority' => 35,
	) );
	$social_sites = tribute_customizer_social_media_array();
	$priority = 5;
	foreach($social_sites as $social_site) {
		$wp_customize->add_setting( "$social_site", array(
				'type'              => 'theme_mod',
				'capability'        => 'edit_theme_options',
				'sanitize_callback' => 'esc_url_raw'
		) );
		$wp_customize->add_control($social_site, array(
				'label'    =>$social_site.' '.__("url:", 'tribute'),
				'section'  => 'my_social_settings',
				'type'     => 'text',
				'priority' => $priority,
		) );
		$priority = $priority + 5;
	}
}

?>