<?php
/**
 * ello-lite-photography Theme Customizer
 *
 * @package ello-lite-photography
 */

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 */
function ello_lite_photography_customize_register( $wp_customize ) {
	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';

	if ( isset( $wp_customize->selective_refresh ) ) {
		$wp_customize->selective_refresh->add_partial(
			'blogname',
			array(
				'selector'        => '.site-title a',
				'render_callback' => 'ello_lite_photography_customize_partial_blogname',
			)
		);
		$wp_customize->selective_refresh->add_partial(
			'blogdescription',
			array(
				'selector'        => '.site-description',
				'render_callback' => 'ello_lite_photography_customize_partial_blogdescription',
			)
		);
	}
}
add_action( 'customize_register', 'ello_lite_photography_customize_register' );

/**
 * Render the site title for the selective refresh partial.
 *
 * @return void
 */
function ello_lite_photography_customize_partial_blogname() {
	bloginfo( 'name' );
}

/**
 * Render the site tagline for the selective refresh partial.
 *
 * @return void
 */
function ello_lite_photography_customize_partial_blogdescription() {
	bloginfo( 'description' );
}

/**
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
 */
function ello_lite_photography_customize_preview_js() {
	wp_enqueue_script( 'ello-lite-photography-customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), ELLO_LITE_PHOTOGRAPHY_VERSION, true );
}
require get_template_directory() . '/inc/ellolitephotography_recommended_plugin.php';
add_action( 'customize_preview_init', 'ello_lite_photography_customize_preview_js' );

/**
 * PRO PAGE
 */

 require get_template_directory() . '/inc/go-pro/class-customize.php';


/*-----------------------------------------------------------------------------------*/
/*	Customizer
/*-----------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------*/
/*	Theme Info 
/*-----------------------------------------------------------------------------------*/
function ello_lite_photography_themeinfo_settings( $wp_customize ) {
	$wp_customize->add_section( 'theme_info', array(
		'title'       => __( 'Demo & Documentation', 'ello-lite-photography' ),
		'priority'    => 6,
	) );
	
	/** Important Links */
	$wp_customize->add_setting( 'theme_info_theme',
		array(
			'default' => '',
			'sanitize_callback' => 'wp_kses_post',
		)
	);

	$theme_info = '';
	$theme_info .= sprintf( '<p>' . __( 'Demo Link: %1$sClick here.%2$s', 'ello-lite-photography' ) . '</p>', '<a href="' . esc_url( 'https://pixelonetry.com/previews/?theme=ello-lite' ) . '" target="_blank">', '</a>' );
	$theme_info .= sprintf( '<p>' . __( 'Pro Demo Link: %1$sClick here.%2$s', 'ello-lite-photography' ) . '</p>', '<a href="' . esc_url( 'https://pixelonetry.com/previews/?theme=ello' ) . '" target="_blank">', '</a>' );
	$theme_info .= sprintf( '<p>' . __( 'Documentation: %1$sClick here.%2$s', 'ello-lite-photography' ) . '</p>', '<a href="' . esc_url( 'https://pixelonetry.com/docs/spirallite/' ) . '" target="_blank">', '</a>' );
	$theme_info .= sprintf( '<p>' . __( 'Video Tutorial: %1$sClick here.%2$s', 'ello-lite-photography' ) . '</p>', '<a href="' . esc_url( 'https://www.youtube.com/watch?v=NVbuDPmXuaU' ) . '" target="_blank">', '</a>' );
	$theme_info .= sprintf( '<p>' . __( 'Rate The Theme: %1$sClick here.%2$s', 'ello-lite-photography' ) . '</p>', '<a href="' . esc_url( 'https://wordpress.org/support/theme/ello-lite-photography/reviews/#new-post' ) . '" target="_blank">', '</a>' );
	$theme_info .= sprintf( '<p>' . __( 'Submit Ticket: %1$sClick here.%2$s', 'ello-lite-photography' ) . '</p>', '<a href="' . esc_url( 'https://pixelonetry.freshdesk.com/support/tickets/new' ) . '" target="_blank">', '</a>' );

	$wp_customize->add_control( new WP_Customize_Control( $wp_customize,
		'theme_info_theme',
		array(
			'section'     => 'theme_info',
			'description' => $theme_info,
			'type'        => 'hidden', // Optional, can hide the control input
		)
	)); 
}
add_action( 'customize_register', 'ello_lite_photography_themeinfo_settings' );
/*-----------------------------------------------------------------------------------*/
/*	Common 
/*-----------------------------------------------------------------------------------*/
function ello_lite_photography_my_register_additional_customizer_settings( $wp_customize ) {
	
	$wp_customize->add_section(
		'ello_blog_setting', 
		array(
			'title' => esc_html__( 'Blog Settings', 'ello-lite-photography' ),
			'priority' => 30,
		)
	);
	
	/** Blog Head Title */
	$wp_customize->add_setting(
		'ello_blog_heading_title',
		array(
			'default' => __( 'News & Blog', 'ello-lite-photography' ),
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	
	$wp_customize->add_control(
		'ello_blog_heading_title',
		array(
			'label' => __( 'Blog Head Title', 'ello-lite-photography' ),
			'section' => 'ello_blog_setting', // Corrected 'panel' to 'section'
			'type' => 'text',
		)
	);

	/** Blog Head Subtitle */
	$wp_customize->add_setting(
		'ello_blog_heading_subtitle',
		array(
			'default' => __( 'Currient Reading', 'ello-lite-photography' ),
			'sanitize_callback' => 'sanitize_text_field',
		)
	);
	
	$wp_customize->add_control(
		'ello_blog_heading_subtitle',
		array(
			'label' => __( 'Blog Head Subtitle', 'ello-lite-photography' ),
			'section' => 'ello_blog_setting', // Corrected 'panel' to 'section'
			'type' => 'text',
		)
	);
	
 }
 add_action( 'customize_register', 'ello_lite_photography_my_register_additional_customizer_settings' );

 function ello_lite_photography_footer_customizer_settings( $wp_customize ) {

 /**  
 *  Section Footer
 */
$wp_customize->add_panel(
	'footer_sections', array(
		'priority' => 40,
		'title' => esc_html__( 'Footer', 'ello-lite-photography' ),
	)
);

$wp_customize->add_section(
	'ellolite_footer_content_section',
	array(
		'title' => __( 'Footer Content', 'ello-lite-photography' ),
		'description' => __( 'Footer Content ', 'ello-lite-photography' ),
		'panel' => 'footer_sections',
		'priority' => 40,
	)
);

$wp_customize->add_setting(
	'ello_footer_adress',
	array(
		'default'=> '<span>address: </span> Beverly Hills, Los Angeles CA, USA',
		'sanitize_callback' => 'wp_kses_post',
		
	)
);

$wp_customize->add_control(
	'ello_footer_adress',
	array(
		'label' => __( 'Adress', 'ello-lite-photography' ),
		'section' => 'ellolite_footer_content_section',
		'type' => 'textarea',
	)
);

$wp_customize->add_setting(
	'ello_footer_phone',
	array(
		'default'=> '<span>phone: </span> +(123) 456 789',
		'sanitize_callback' => 'wp_kses_post',
		
	)
);

$wp_customize->add_control(
	'ello_footer_phone',
	array(
		'label' => __( 'Phone', 'ello-lite-photography' ),
		'section' => 'ellolite_footer_content_section',
		'type' => 'textarea',
	)
);

$wp_customize->add_setting(
	'ello_footer_email',
	array(
		'default'=> '<span>e-mail: </span>info@thedomain.com',
		'sanitize_callback' => 'wp_kses_post',
		
	)
);

$wp_customize->add_control(
	'ello_footer_email',
	array(
		'label' => __( 'Phone', 'ello-lite-photography' ),
		'section' => 'ellolite_footer_content_section',
		'type' => 'textarea',
	)
);

$wp_customize->add_section(
	'ellolite_footer',
	array(
		'title' => __( 'Footer Copyright', 'ello-lite-photography' ),
		'description' => __( 'Footer Settings ', 'ello-lite-photography' ),
		'panel' => 'footer_sections',
		'priority' => 40,
	)
);
 $wp_customize->add_setting(
	'ello_copyright',
	array(
		'default' => sprintf(__('Copyright 2024. <span>%s</span> All Rights Reserved.', 'ello-lite-photography'), get_bloginfo('name')),
		'sanitize_callback' => 'wp_kses_post',
	)
);

$wp_customize->add_control(
	'ello_copyright',
	array(
		'label' => __( 'Copyright', 'ello-lite-photography' ),
		'section' => 'ellolite_footer',
		'type' => 'textarea',
	)
);
}
add_action( 'customize_register', 'ello_lite_photography_footer_customizer_settings' );

function ello_lite_photography_social_customizer_settings( $wp_customize ) {

	/*-----------------------------------------------------------------------------------*/
/*	Social Setting
/*-----------------------------------------------------------------------------------*/

$wp_customize->add_section(
	'ellolite_social_settings',
	array(
		'title' => __( 'Social Settings', 'ello-lite-photography' ),
		'description' => __( 'Leave blank if you do not want to show the social link.', 'ello-lite-photography' ),
		'priority' => 40,
	)
);

/** Facebook */
$wp_customize->add_setting(
	'ellolite_facebook',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'ellolite_facebook',
	array(
		'label' => __( 'Facebook', 'ello-lite-photography' ),
		'section' => 'ellolite_social_settings',
		'type' => 'text',
	)
);

/** Twitter */
$wp_customize->add_setting(
	'ellolite_twitter',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'ellolite_twitter',
	array(
		'label' => __( 'Twitter', 'ello-lite-photography' ),
		'section' => 'ellolite_social_settings',
		'type' => 'text',
	)
);

/** Pinterest */
$wp_customize->add_setting(
	'ellolite_pinterest',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'ellolite_pinterest',
	array(
		'label' => __( 'Pinterest', 'ello-lite-photography' ),
		'section' => 'ellolite_social_settings',
		'type' => 'text',
	)
);

/** LinkedIn */
$wp_customize->add_setting(
	'ellolite_linkedin',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'ellolite_linkedin',
	array(
		'label' => __( 'LinkedIn', 'ello-lite-photography' ),
		'section' => 'ellolite_social_settings',
		'type' => 'text',
	)
);

/** Instagram Plus */
$wp_customize->add_setting(
	'ellolite_instagram',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'ellolite_instagram',
	array(
		'label' => __( 'Instagram', 'ello-lite-photography' ),
		'section' => 'ellolite_social_settings',
		'type' => 'text',
	)
);

/** Youtube Plus */
$wp_customize->add_setting(
	'ellolite_youtube',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'ellolite_youtube',
	array(
		'label' => __( 'YouTube', 'ello-lite-photography' ),
		'section' => 'ellolite_social_settings',
		'type' => 'text',
	)
);

/** Tiktok */
$wp_customize->add_setting(
	'ellolite_tiktok',
	array(
		'default' => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'ellolite_tiktok',
	array(
		'label' => __( 'Tiktok', 'ello-lite-photography' ),
		'section' => 'ellolite_social_settings',
		'type' => 'text',
	)
);


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