<?php
/**
 * Handle customizer options
 *
 * @package Meridian One
 * @since 1.0
 */

/**
 * register options
 *
 * @since 1.0
 */
function meridian_one_customizer_register_options( $options ) {

	$prefix = 'meridian_one_';

	// Home
	$options[] = array(
		'type'	=> 'panel',
		'id'	=> $prefix . 'home',
		'title' => esc_html__( 'Home', 'meridian-one' ),
	);

			/**
			 * Features
			 */
			$options[] = array(
				'type'	=> 'section',
				'id'	=> $prefix . 'home_slider',
				'title' => esc_html__( 'Hero Banner', 'meridian-one' ),
			);

				$options['home_slider_section_enabled'] = array(
					'type'	=> 'option_checkbox',
					'title' => esc_html__( 'Enable section', 'meridian-one' ),
					'id'	=> $prefix . 'home_slider_section_enabled',
					'def'	=> '',
				);

				$options['home_slider_section_image'] = array(
					'type'	=> 'option_image',
					'title' => esc_html__( 'Image', 'meridian-one' ),
					'id'	=> $prefix . 'home_slider_section_image',
					'def'	=> '',
				);
				
				$options['home_slider_section_heading'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Title', 'meridian-one' ),
					'id'	=> $prefix . 'home_slider_section_heading',
					'def'	=> '',
				);

				$options['home_slider_section_content'] = array(
					'type'	=> 'option_textarea',
					'title' => esc_html__( 'Content', 'meridian-one' ),
					'id'	=> $prefix . 'home_slider_section_content',
					'def'	=> '',
				);

				$options['home_slider_section_button_url'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Button URL', 'meridian-one' ),
					'id'	=> $prefix . 'home_slider_section_button_url',
					'def'	=> '',
				);

				$options['home_slider_section_button_text'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Button Text', 'meridian-one' ),
					'id'	=> $prefix . 'home_slider_section_button_text',
					'def'	=> '',
				);

			/**
			 * Features
			 */
			$options[] = array(
				'type'	=> 'section',
				'id'	=> 'mt-sidebar-widgets-sidebar-home-features',
				'title' => esc_html__( 'Features', 'meridian-one' ),
				'descr' => esc_html__( 'You can add/edit the items in Customizer > Widgets > Home Slider.', 'meridian-one' ),
			);

				$options['home_features_section_enabled'] = array(
					'type'	=> 'option_checkbox',
					'title' => esc_html__( 'Enable section', 'meridian-one' ),
					'id'	=> $prefix . 'home_features_section_enabled',
					'def'	=> '',
				);

				$options['home_features_section_title'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Title', 'meridian-one' ),
					'id'	=> $prefix . 'home_features_section_title',
					'def'	=> '',
				);

				$options['home_features_section_subtitle'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Subtitle', 'meridian-one' ),
					'id'	=> $prefix . 'home_features_section_subtitle',
					'def'	=> '',
				);

				$options['home_features_section_description'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Description', 'meridian-one' ),
					'id'	=> $prefix . 'home_features_section_description',
					'def'	=> '',
				);

				$options['home_features_section_image'] = array(
					'type'	=> 'option_image',
					'title' => esc_html__( 'Image', 'meridian-one' ),
					'id'	=> $prefix . 'home_features_section_image',
					'def'	=> '',
				);

				$options['home_features_section_image_title'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Image Title', 'meridian-one' ),
					'id'	=> $prefix . 'home_features_section_image_title',
					'def'	=> '',
				);

				$options['home_features_section_image_description'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Image Description', 'meridian-one' ),
					'id'	=> $prefix . 'home_features_section_image_description',
					'def'	=> '',
				);

			/**
			 * About
			 */
			$options[] = array(
				'type'	=> 'section',
				'id'	=> 'mt-sidebar-widgets-sidebar-home-about',
				'title' => esc_html__( 'About', 'meridian-one' ),
				'descr' => esc_html__( 'You can add/edit the items in Customizer > Widgets > Home About.', 'meridian-one' ),
			);

				$options['home_about_section_enabled'] = array(
					'type'	=> 'option_checkbox',
					'title' => esc_html__( 'Enable section', 'meridian-one' ),
					'id'	=> $prefix . 'home_about_section_enabled',
					'def'	=> '',
				);

				$options['home_about_section_title'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Title', 'meridian-one' ),
					'id'	=> $prefix . 'home_about_section_title',
					'def'	=> '',
				);

				$options['home_about_section_subtitle'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Subtitle', 'meridian-one' ),
					'id'	=> $prefix . 'home_about_section_subtitle',
					'def'	=> '',
				);

				$options['home_about_section_description'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Description', 'meridian-one' ),
					'id'	=> $prefix . 'home_about_section_description',
					'def'	=> '',
				);

			/**
			 * Tour
			 */
			$options[] = array(
				'type'	=> 'section',
				'id'	=> $prefix . 'home_tour',
				'title' => esc_html__( 'Tour', 'meridian-one' ),
			);

				$options['home_tour_section_enabled'] = array(
					'type'	=> 'option_checkbox',
					'title' => esc_html__( 'Enable section', 'meridian-one' ),
					'id'	=> $prefix . 'home_tour_section_enabled',
					'def'	=> '',
				);

				$options['home_tour_section_video_url'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Video URL', 'meridian-one' ),
					'id'	=> $prefix . 'home_tour_section_video_url',
					'def'	=> '',
				);

				$options['home_tour_section_image'] = array(
					'type'	=> 'option_image',
					'title' => esc_html__( 'Background Image', 'meridian-one' ),
					'id'	=> $prefix . 'home_tour_section_image',
					'def'	=> '',
				);

				$options['home_tour_section_title'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Title', 'meridian-one' ),
					'id'	=> $prefix . 'home_tour_section_title',
					'def'	=> '',
				);

			/**
			 * Services
			 */
			$options[] = array(
				'type'	=> 'section',
				'id'	=> 'mt-sidebar-widgets-sidebar-home-services',
				'title' => esc_html__( 'Services', 'meridian-one' ),
				'descr' => esc_html__( 'You can add/edit the items in Customizer > Widgets > Home Services.', 'meridian-one' ),
			);

				$options['home_services_section_enabled'] = array(
					'type'	=> 'option_checkbox',
					'title' => esc_html__( 'Enable section', 'meridian-one' ),
					'id'	=> $prefix . 'home_services_section_enabled',
					'def'	=> '',
				);

				$options['home_services_section_title'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Title', 'meridian-one' ),
					'id'	=> $prefix . 'home_services_section_title',
					'def'	=> '',
				);

				$options['home_services_section_subtitle'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Subtitle', 'meridian-one' ),
					'id'	=> $prefix . 'home_services_section_subtitle',
					'def'	=> '',
				);

				$options['home_services_section_description'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Description', 'meridian-one' ),
					'id'	=> $prefix . 'home_services_section_description',
					'def'	=> '',
				);

			/**
			 * Process
			 */
			$options[] = array(
				'type'	=> 'section',
				'id'	=> 'mt-sidebar-widgets-sidebar-home-process',
				'title' => esc_html__( 'Process', 'meridian-one' ),
				'descr' => esc_html__( 'You can add/edit the items in Customizer > Widgets > Home Process.', 'meridian-one' ),
			);

				$options['home_process_section_enabled'] = array(
					'type'	=> 'option_checkbox',
					'title' => esc_html__( 'Enable section', 'meridian-one' ),
					'id'	=> $prefix . 'home_process_section_enabled',
					'def'	=> '',
				);

				$options['home_process_section_button_text'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Button Text', 'meridian-one' ),
					'id'	=> $prefix . 'home_process_section_button_text',
					'def'	=> '',
				);

				$options['home_process_section_button_url'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Button URL', 'meridian-one' ),
					'id'	=> $prefix . 'home_process_section_button_url',
					'def'	=> '',
				);

			/**
			 * Testimonials
			 */
			$options[] = array(
				'type'	=> 'section',
				'id'	=> 'mt-sidebar-widgets-sidebar-home-testimonials',
				'title' => esc_html__( 'Testimonials', 'meridian-one' ),
				'descr' => esc_html__( 'You can add/edit the items in Customizer > Widgets > Home Testimonials.', 'meridian-one' ),
			);

				$options['home_testimonials_section_enabled'] = array(
					'type'	=> 'option_checkbox',
					'title' => esc_html__( 'Enable section', 'meridian-one' ),
					'id'	=> $prefix . 'home_testimonials_section_enabled',
					'def'	=> '',
				);

				$options['home_testimonials_section_title'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Title', 'meridian-one' ),
					'id'	=> $prefix . 'home_testimonials_section_title',
					'def'	=> '',
				);

				$options['home_testimonials_section_subtitle'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Subtitle', 'meridian-one' ),
					'id'	=> $prefix . 'home_testimonials_section_subtitle',
					'def'	=> '',
				);

				$options['home_testimonials_customers_count_num'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Customers Count Number', 'meridian-one' ),
					'id'	=> $prefix . 'home_testimonials_customers_count_num',
					'def'	=> '',
				);

				$options['home_testimonials_customers_count_text'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Customers Count Text', 'meridian-one' ),
					'id'	=> $prefix . 'home_testimonials_customers_count_text',
					'def'	=> '',
				);

			/**
			 * Clients
			 */
			$options[] = array(
				'type'	=> 'section',
				'id'	=> 'mt-sidebar-widgets-sidebar-home-clients',
				'title' => esc_html__( 'Clients', 'meridian-one' ),
				'descr' => esc_html__( 'You can add/edit the items in Customizer > Widgets > Home Clients.', 'meridian-one' ),
			);

				$options['home_clients_section_enabled'] = array(
					'type'	=> 'option_checkbox',
					'title' => esc_html__( 'Enable section', 'meridian-one' ),
					'id'	=> $prefix . 'home_clients_section_enabled',
					'def'	=> '',
				);

			/**
			 * Team
			 */
			$options[] = array(
				'type'	=> 'section',
				'id'	=> 'mt-sidebar-widgets-sidebar-home-team',
				'title' => esc_html__( 'Team', 'meridian-one' ),
				'descr' => esc_html__( 'You can add/edit the items in Customizer > Widgets > Home Team.', 'meridian-one' ),
			);

				$options['home_team_section_enabled'] = array(
					'type'	=> 'option_checkbox',
					'title' => esc_html__( 'Enable section', 'meridian-one' ),
					'id'	=> $prefix . 'home_team_section_enabled',
					'def'	=> '',
				);

				$options['home_team_section_title'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Title', 'meridian-one' ),
					'id'	=> $prefix . 'home_team_section_title',
					'def'	=> '',
				);

				$options['home_team_section_subtitle'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Subtitle', 'meridian-one' ),
					'id'	=> $prefix . 'home_team_section_subtitle',
					'def'	=> '',
				);

				$options['home_team_section_description'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Description', 'meridian-one' ),
					'id'	=> $prefix . 'home_team_section_description',
					'def'	=> '',
				);

				$options['home_team_section_button_text'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Button Text', 'meridian-one' ),
					'id'	=> $prefix . 'home_team_section_button_text',
					'def'	=> '',
				);

				$options['home_team_section_button_url'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Button URL', 'meridian-one' ),
					'id'	=> $prefix . 'home_team_section_button_url',
					'def'	=> '',
				);

			/**
			 * Blog
			 */
			$options[] = array(
				'type'	=> 'section',
				'id'	=> $prefix . 'home_blog',
				'title' => esc_html__( 'Blog', 'meridian-one' ),
			);

				$options['home_blog_section_enabled'] = array(
					'type'	=> 'option_checkbox',
					'title' => esc_html__( 'Enable section', 'meridian-one' ),
					'id'	=> $prefix . 'home_blog_section_enabled',
					'def'	=> '',
				);

				$options['home_blog_section_title'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Title', 'meridian-one' ),
					'id'	=> $prefix . 'home_blog_section_title',
					'def'	=> '',
				);

				$options['home_blog_section_subtitle'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Subtitle', 'meridian-one' ),
					'id'	=> $prefix . 'home_blog_section_subtitle',
					'def'	=> '',
				);

				$options['home_blog_section_button_text'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Button Text', 'meridian-one' ),
					'id'	=> $prefix . 'home_blog_section_button_text',
					'def'	=> '',
				);

				$options['home_blog_section_button_url'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Button URL', 'meridian-one' ),
					'id'	=> $prefix . 'home_blog_section_button_url',
					'def'	=> '',
				);

			/**
			 * Contact
			 */
			$options[] = array(
				'type'	=> 'section',
				'id'	=> 'mt-sidebar-widgets-sidebar-home-contact',
				'title' => esc_html__( 'Contact', 'meridian-one' ),
			);

				$options['home_contact_section_enabled'] = array(
					'type'	=> 'option_checkbox',
					'title' => esc_html__( 'Enable section', 'meridian-one' ),
					'id'	=> $prefix . 'home_contact_section_enabled',
					'def'	=> '',
				);

				$options['home_contact_section_title'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Title', 'meridian-one' ),
					'id'	=> $prefix . 'home_contact_section_title',
					'def'	=> '',
				);

				$options['home_contact_section_subtitle'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Section Subtitle', 'meridian-one' ),
					'id'	=> $prefix . 'home_contact_section_subtitle',
					'def'	=> '',
				);

				$options['home_contact_section_map_url'] = array(
					'type'	=> 'option_textarea',
					'title' => esc_html__( 'Google Maps Embed URL', 'meridian-one' ),
					'descr' => esc_html__( 'Check documentation for more info.', 'meridian-one' ),
					'id'	=> $prefix . 'home_contact_section_map_url',
					'def'	=> '',
				);

				$options['home_contact_section_form_shortcode'] = array(
					'type'	=> 'option_text',
					'title' => esc_html__( 'Form Shortcode', 'meridian-one' ),
					'descr' => esc_html__( 'Suggested plugin is Contact Form 7. Check documentation for more info.', 'meridian-one' ),
					'id'	=> $prefix . 'home_contact_section_form_shortcode',
					'def'	=> '',
				);

	// Footer
	$options[] = array(
		'type'	=> 'panel',
		'id'	=> $prefix . 'other',
		'title' => esc_html__( 'Footer', 'meridian-one' ),
	);

		// Subscribe
		$options[] = array(
			'type'	=> 'section',
			'id'	=> $prefix . 'subscribe',
			'title' => esc_html__( 'Subscribe', 'meridian-one' ),
		);

			$options['footer_subscribe_enabled'] = array(
				'type'	=> 'option_checkbox',
				'title' => esc_html__( 'Enable section', 'meridian-one' ),
				'id'	=> $prefix . 'footer_subscribe_enabled',
				'def'	=> '',
			);

			$options['footer_subscribe_title'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Title', 'meridian-one' ),
				'id'	=> $prefix . 'footer_subscribe_title',
				'def'	=> '',
			);

			$options['footer_subscribe_subtitle'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Subtitle', 'meridian-one' ),
				'id'	=> $prefix . 'footer_subscribe_subtitle',
				'def'	=> '',
			);

			$options['footer_subscribe_content'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Content', 'meridian-one' ),
				'id'	=> $prefix . 'footer_subscribe_content',
				'def'	=> '',
			);

		// Social
		$options[] = array(
			'type'	=> 'section',
			'id'	=> $prefix . 'social',
			'title' => esc_html__( 'Social', 'meridian-one' ),
		);

			$options['social_twitter'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Twitter URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_twitter',
				'def'	=> '',
			);

			$options['social_facebook'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Facebook URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_facebook',
				'def'	=> '',
			);

			$options['social_youtube'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Youtube URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_youtube',
				'def'	=> '',
			);

			$options['social_vimeo'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Vimeo URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_vimeo',
				'def'	=> '',
			);

			$options['social_tumblr'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Tumblr URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_tumblr',
				'def'	=> '',
			);

			$options['social_pinterest'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Pinterest URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_pinterest',
				'def'	=> '',
			);

			$options['social_linkedin'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'LinkedIn URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_linkedin',
				'def'	=> '',
			);

			$options['social_instagram'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Instagram URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_instagram',
				'def'	=> '',
			);

			$options['social_github'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Github URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_github',
				'def'	=> '',
			);

			$options['social_googleplus'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Google Plus URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_googleplus',
				'def'	=> '',
			);

			$options['social_dribbble'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Dribbble URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_dribbble',
				'def'	=> '',
			);

			$options['social_dropbox'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Dropbox URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_dropbox',
				'def'	=> '',
			);

			$options['social_flickr'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Flickr URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_flickr',
				'def'	=> '',
			);

			$options['social_foursquare'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Foursquare URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_foursquare',
				'def'	=> '',
			);

			$options['social_behance'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Behance URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_behance',
				'def'	=> '',
			);

			$options['social_vine'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'Vine URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_vine',
				'def'	=> '',
			);

			$options['social_rss'] = array(
				'type'	=> 'option_text',
				'title' => esc_html__( 'RSS URL', 'meridian-one' ),
				'id'	=> $prefix . 'social_rss',
				'def'	=> '',
			);
		
	return $options;

} add_filter( 'meridian_one_customizer_register', 'meridian_one_customizer_register_options', 10, 1 );

/**
 * add options to customizer
 *
 * @since 1.0
 */
function meridian_one_customizer_register( $wp_customize ) {
	
	$customizer_options = apply_filters( 'meridian_one_customizer_register', array() );

	$panel_priority = 200;
	$section_priority = 200;
	$setting_priority = 5;
	$current_panel_id = '';
	$current_section_id = '';
	$current_setting_id = '';
	
	foreach ( $customizer_options as $customizer_option ) {

		if ( ! isset( $customizer_option['descr'] ) ) {
			$customizer_option['descr'] = '';
		}

		if ( $customizer_option['type'] == 'panel' ) {
			
			/* New Section */
			
			$panel_priority += 50;
			$setting_priority = 5;
			$current_panel_id = $customizer_option['id'];

			if ( ! isset( $customizer_option['descr'] ) )
				$customizer_option['descr'] = '';

			$wp_customize->add_panel( $current_panel_id, array(
				'title' => $customizer_option['title'],
				'priority' => $panel_priority,
				'description' => $customizer_option['descr'],
			) );

		} elseif ( $customizer_option['type'] == 'section' ){
			
			/* New Section */
			
			$section_priority += 50;
			$setting_priority = 5;
			$current_section_id = $customizer_option['id'];

			if ( ! isset( $customizer_option['descr'] ) )
				$customizer_option['descr'] = '';
			
			$wp_customize->add_section( $current_section_id, array(
				'title' => $customizer_option['title'],
				'priority' => $section_priority,
				'description' => $customizer_option['descr'],
				'panel' => $current_panel_id,
			) );
			
		} elseif ( $customizer_option['type'] == 'option_color' ) {
			
			/* New Option (COLOR) */
			
			$current_setting_id = $customizer_option['id'];
			$setting_priority += 5;
			
			$wp_customize->add_setting( $current_setting_id, array(
				'default' => $customizer_option['def'],
				'type' => 'theme_mod',
				'sanitize_callback' => 'sanitize_text_field',
			) );
			
				$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $current_setting_id, array(
					'label' => $customizer_option['title'],
					'section' => $current_section_id,
					'priority' => $setting_priority,
					'description' => $customizer_option['descr'],
				) ) );
			
		} elseif ( $customizer_option['type'] == 'option_text' ) {
			
			/* New Option (TEXT) */
			
			$current_setting_id = $customizer_option['id'];
			$setting_priority += 5;

			$wp_customize->add_setting( $current_setting_id, array(
				'default'	=> $customizer_option['def'],
				'type'		=> 'theme_mod',
				'sanitize_callback' => 'sanitize_text_field',
			) );
				
				$wp_customize->add_control( $current_setting_id, array(
					'label'		=> $customizer_option['title'],
					'section' 	=> $current_section_id,
					'type'		=> 'text',
					'priority'	=> $setting_priority,
					'description' => $customizer_option['descr'],
				));

		} elseif ( $customizer_option['type'] == 'option_textarea' ) {
			
			/* New Option (TEXT) */
			
			$current_setting_id = $customizer_option['id'];
			$setting_priority += 5;

			$wp_customize->add_setting( $current_setting_id, array(
				'default'	=> $customizer_option['def'],
				'type'		=> 'theme_mod',
				'sanitize_callback' => 'sanitize_text_field',
			) );
				
				$wp_customize->add_control( $current_setting_id, array(
					'label'		=> $customizer_option['title'],
					'section' 	=> $current_section_id,
					'type'		=> 'textarea',
					'priority'	=> $setting_priority,
					'description' => $customizer_option['descr'],
				));
			
		} elseif ( $customizer_option['type'] == 'option_select' ) {
			
			/* New Option (SELECT) */
			
			$current_setting_id = $customizer_option['id'];
			$setting_priority += 5;
			
			$wp_customize->add_setting( $current_setting_id, array(
				'default'	=> $customizer_option['def'],
				'type'		=> 'theme_mod',
				'sanitize_callback' => 'sanitize_text_field',
			) );
				
				$wp_customize->add_control( $current_setting_id, array(
					'label'		=> $customizer_option['title'],
					'section' 	=> $current_section_id,
					'type'		=> 'select',
					'choices'	=> $customizer_option['opts'],
					'priority'	=> $setting_priority,
					'description' => $customizer_option['descr'],
				));
			
		} elseif ( $customizer_option['type'] == 'option_checkbox' ) {
			
			/* New Option (checkbox) */
			
			$current_setting_id = $customizer_option['id'];
			$setting_priority += 5;
			
			$wp_customize->add_setting( $current_setting_id, array(
				'default'	=> $customizer_option['def'],
				'type'		=> 'theme_mod',
				'sanitize_callback' => 'absint',
			) );
				
				$wp_customize->add_control( $current_setting_id, array(
					'label'		=> $customizer_option['title'],
					'section' 	=> $current_section_id,
					'type'		=> 'checkbox',
					'priority'	=> $setting_priority,
					'description' => $customizer_option['descr'],
				));

		} elseif ( $customizer_option['type'] == 'option_image' ) {
			
			/* New Option (image) */
			
			$current_setting_id = $customizer_option['id'];
			$setting_priority += 5;
			
			$wp_customize->add_setting( $current_setting_id, array(
				'default'	=> $customizer_option['def'],
				'type'		=> 'theme_mod',
				'sanitize_callback' => 'esc_url_raw',
			) );
			
				$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, $current_setting_id, array(
					'label'		=> $customizer_option['title'],
					'section' 	=> $current_section_id,
					'priority'	=> $setting_priority,
					'description' => $customizer_option['descr'],
				) ) );
			
		}
		
	}

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

function meridian_one_get_theme_option( $option_id ) {

	$customizer_options = apply_filters( 'meridian_one_customizer_register', array() );

	if ( isset( $customizer_options[$option_id] ) && isset( $customizer_options[$option_id]['def'] ) ) {
		$default = $customizer_options[$option_id]['def'];
	} else {
		$default = '';
	}

	$return = get_theme_mod( 'meridian_one_' . $option_id, $default );

	return $return;

}