<?php
/**
*Typography customizer options
*
* @package WalkerPress
*
*/
require get_template_directory() . '/inc/walkerpress-google-fonts.php';

if (! function_exists('walkerpress_typography_options_register')) {
	function walkerpress_typography_options_register( $wp_customize ) {
	//Typography
		$wp_customize->add_section('walkerpress_site_typography', 
		 	array(
		        'title' => esc_html__('Typography', 'walkerpress'),
		        'panel' =>'walkerpress_theme_option',
		        'priority' => 1,
		        'divider' => 'before',
	    	)
		 );
	

		$wp_customize->add_setting( 'walkerpress_body_fonts', array(
				'sanitize_callback' => 'walkerpress_sanitize_fonts',
				'default' => 'Oxygen',
			)
		);

		$wp_customize->add_control( 'walkerpress_body_fonts', array(
				'type' => 'select',
				'label'		  => esc_html__( 'Body Typography', 'walkerpress' ),
				'description' => esc_html__('Font Family','walkerpress'),
				'section' => 'walkerpress_site_typography',
				'choices' => walkerpress_google_fonts()
			)
		);
		$wp_customize->add_setting(
		    	'walkerpress_font_size',
		    	array(
			        'default'			=> 14,
					'capability'     	=> 'edit_theme_options',
					'sanitize_callback' => 'walkerpress_sanitize_number_absint',
				
				)
			);
			$wp_customize->add_control( 
			new WalkerPress_Customizer_Range_Control( $wp_customize, 'walkerpress_font_size', 
				array(
					'label' => '',
					'description'      => __( 'Font Size for Body [PX]', 'walkerpress'),
					'section'  => 'walkerpress_site_typography',
					'settings' => 'walkerpress_font_size',
		             'input_attrs' => array(
						'min'    => 12,
						'max'    => 24,
						'step'   => 1,
					),
				) ) 
			);

		$wp_customize->add_setting( 'walkerpress_heading_fonts', array(
				'sanitize_callback' => 'walkerpress_sanitize_fonts',
				'default' => 'Roboto',
			)
		);

		$wp_customize->add_control( 'walkerpress_heading_fonts', array(
				'type' => 'select',
				'label'		  => esc_html__( 'Heading Typography', 'walkerpress' ),
				'description' => esc_html__('Font Family','walkerpress'),
				'section' => 'walkerpress_site_typography',
				'choices' => walkerpress_google_fonts()
			)
		);
		$wp_customize->add_setting(
		    	'walkerpress_heading_one_size',
		    	array(
			        'default'			=> 40,
					'capability'     	=> 'edit_theme_options',
					'sanitize_callback' => 'walkerpress_sanitize_number_absint',
				
				)
			);
			$wp_customize->add_control( 
			new WalkerPress_Customizer_Range_Control( $wp_customize, 'walkerpress_heading_one_size', 
				array(
					'label' => '',
					'description'      => __( 'Font Size for H1 [PX]', 'walkerpress'),
					'section'  => 'walkerpress_site_typography',
					'settings' => 'walkerpress_heading_one_size',
		             'input_attrs' => array(
						'min'    => 14,
						'max'    => 120,
						'step'   => 1,
					),
				) ) 
			);

		$wp_customize->add_setting(
		    	'walkerpress_heading_two_size',
		    	array(
			        'default'			=> 32,
					'capability'     	=> 'edit_theme_options',
					'sanitize_callback' => 'walkerpress_sanitize_number_absint',
				
				)
			);
			$wp_customize->add_control( 
			new WalkerPress_Customizer_Range_Control( $wp_customize, 'walkerpress_heading_two_size', 
				array(
					'label' => '',
					'description'      => __( 'Font Size for H2 [PX]', 'walkerpress'),
					'section'  => 'walkerpress_site_typography',
					'settings' => 'walkerpress_heading_two_size',
		             'input_attrs' => array(
						'min'    => 14,
						'max'    => 120,
						'step'   => 1,
					),
				) ) 
			);

		$wp_customize->add_setting(
		    	'walkerpress_heading_three_size',
		    	array(
			        'default'			=> 24,
					'capability'     	=> 'edit_theme_options',
					'sanitize_callback' => 'walkerpress_sanitize_number_absint',
				
				)
			);
			$wp_customize->add_control( 
			new WalkerPress_Customizer_Range_Control( $wp_customize, 'walkerpress_heading_three_size', 
				array(
					'label' => '',
					'description'      => __( 'Font Size for H3 [PX]', 'walkerpress'),
					'section'  => 'walkerpress_site_typography',
					'settings' => 'walkerpress_heading_three_size',
		             'input_attrs' => array(
						'min'    => 14,
						'max'    => 120,
						'step'   => 1,
					),
				) ) 
			);

		$wp_customize->add_setting(
		    	'walkerpress_heading_four_size',
		    	array(
			        'default'			=> 20,
					'capability'     	=> 'edit_theme_options',
					'sanitize_callback' => 'walkerpress_sanitize_number_absint',
				
				)
			);
			$wp_customize->add_control( 
			new WalkerPress_Customizer_Range_Control( $wp_customize, 'walkerpress_heading_four_size', 
				array(
					'label' => '',
					'description'      => __( 'Font Size for H4 [PX]', 'walkerpress'),
					'section'  => 'walkerpress_site_typography',
					'settings' => 'walkerpress_heading_four_size',
		             'input_attrs' => array(
						'min'    => 14,
						'max'    => 120,
						'step'   => 1,
					),
				) ) 
			);

		
		$wp_customize->add_setting(
		    	'walkerpress_heading_five_size',
		    	array(
			        'default'			=> 16,
					'capability'     	=> 'edit_theme_options',
					'sanitize_callback' => 'walkerpress_sanitize_number_absint',
				
				)
			);
			$wp_customize->add_control( 
			new WalkerPress_Customizer_Range_Control( $wp_customize, 'walkerpress_heading_five_size', 
				array(
					'label' => '',
					'description'      => __( 'Font Size for H5 [PX]', 'walkerpress'),
					'section'  => 'walkerpress_site_typography',
					'settings' => 'walkerpress_heading_five_size',
		             'input_attrs' => array(
						'min'    => 14,
						'max'    => 120,
						'step'   => 1,
					),
				) ) 
			);

		$wp_customize->add_setting(
		    	'walkerpress_heading_six_size',
		    	array(
			        'default'			=> 14,
					'capability'     	=> 'edit_theme_options',
					'sanitize_callback' => 'walkerpress_sanitize_number_absint',
				
				)
			);
			$wp_customize->add_control( 
			new WalkerPress_Customizer_Range_Control( $wp_customize, 'walkerpress_heading_six_size', 
				array(
					'label' => '',
					'description'      => __( 'Font Size for H6 [PX]', 'walkerpress'),
					'section'  => 'walkerpress_site_typography',
					'settings' => 'walkerpress_heading_six_size',
		             'input_attrs' => array(
						'min'    => 14,
						'max'    => 120,
						'step'   => 1,
					),
				) ) 
			);

			$wp_customize->add_setting(
		    	'walkerpress_homepage_meta_size',
		    	array(
			        'default'			=> 12,
					'capability'     	=> 'edit_theme_options',
					'sanitize_callback' => 'walkerpress_sanitize_number_absint',
				
				)
			);
			$wp_customize->add_control( 
			new WalkerPress_Customizer_Range_Control( $wp_customize, 'walkerpress_homepage_meta_size', 
				array(
					'label' => '',
					'description'      => __( 'Meta Font Size', 'walkerpress'),
					'section'  => 'walkerpress_extra_settings',
					'settings' => 'walkerpress_homepage_meta_size',
					'priority' => 11,
		             'input_attrs' => array(
						'min'    => 8,
						'max'    => 120,
						'step'   => 1,
					),
				) ) 
			);
			$wp_customize->add_setting(
		    	'walkerpress_homepage_category_size',
		    	array(
			        'default'			=> 12,
					'capability'     	=> 'edit_theme_options',
					'sanitize_callback' => 'walkerpress_sanitize_number_absint',
				
				)
			);
			$wp_customize->add_control( 
			new WalkerPress_Customizer_Range_Control( $wp_customize, 'walkerpress_homepage_category_size', 
				array(
					'label' => '',
					'description'      => __( 'Category Font Size', 'walkerpress'),
					'section'  => 'walkerpress_extra_settings',
					'settings' => 'walkerpress_homepage_category_size',
					'priority' => 21,
		             'input_attrs' => array(
						'min'    => 8,
						'max'    => 120,
						'step'   => 1,
					),
				) ) 
			);
			$wp_customize->add_setting(
		    	'walkerpress_homepage_header_size',
		    	array(
			        'default'			=> 18,
					'capability'     	=> 'edit_theme_options',
					'sanitize_callback' => 'walkerpress_sanitize_number_absint',
				
				)
			);
			$wp_customize->add_control( 
			new WalkerPress_Customizer_Range_Control( $wp_customize, 'walkerpress_homepage_header_size', 
				array(
					'label' => '',
					'description'      => __( 'Main Header Font Size', 'walkerpress'),
					'section'  => 'walkerpress_extra_settings',
					'settings' => 'walkerpress_homepage_header_size',
					'priority' => 2,
		             'input_attrs' => array(
						'min'    => 14,
						'max'    => 120,
						'step'   => 1,
					),
				) ) 
			);
		
	}

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