<?php if( ! defined( 'ABSPATH' ) ) exit;

/**
 * Enqueue scripts and styles.
 */
function lotus_beautyhoto_links_scripts() {	
	wp_enqueue_style( 'lotus-beauty-photo-links-css', get_template_directory_uri() . '/include/photo-links/photo-links.css' );
}
add_action( 'wp_enqueue_scripts', 'lotus_beautyhoto_links_scripts' );

function lotus_beautyhoto_links () { ?>
<div class="b-cont">
    <div class="vintalight" id="vintalight">

	<?php if ( get_theme_mod('photo_image_1') ) { ?>
		<figure class="vintalight__container">
			<a href="<?php echo esc_url( get_theme_mod( 'lotus_beautyhoto_links_URL1' ) ); ?>">
				<div class="vintalight__container__photo">
					<img class="vintalight__container__photo__img" src="<?php echo esc_url( get_theme_mod('photo_image_1') ); ?>" alt="Image">
				</div>
				<figcaption class="vintalight__container__caption">
					<h3 class="vintalight__container__caption__text"><?php echo esc_html( get_theme_mod('lotus_beautyhoto_links_title1') ); ?></h3>
				</figcaption>
			</a>
		</figure>
	<?php } ?>
	<?php if ( get_theme_mod('photo_image_2') ) { ?>
		<figure class="vintalight__container">
			<a href="<?php echo esc_url( get_theme_mod( 'lotus_beautyhoto_links_URL2' ) ); ?>">
				<div class="vintalight__container__photo">
					<img class="vintalight__container__photo__img" src="<?php echo esc_url( get_theme_mod('photo_image_2') ); ?>" alt="Image">
				</div>
				<figcaption class="vintalight__container__caption">
					<h3 class="vintalight__container__caption__text"><?php echo esc_html( get_theme_mod('lotus_beautyhoto_links_title2') ); ?></h3>
				</figcaption>
			</a>
		</figure>
	<?php } ?>
	<?php if ( get_theme_mod('photo_image_3') ) { ?>
		<figure class="vintalight__container">
			<a href="<?php echo esc_url( get_theme_mod( 'lotus_beautyhoto_links_URL3' ) ); ?>">
				<div class="vintalight__container__photo">
					<img class="vintalight__container__photo__img" src="<?php echo esc_url( get_theme_mod('photo_image_3') ); ?>" alt="Image">
				</div>
				<figcaption class="vintalight__container__caption">
					<h3 class="vintalight__container__caption__text"><?php echo esc_html( get_theme_mod('lotus_beautyhoto_links_title3') ); ?></h3>
				</figcaption>
			</a>
		</figure>
	<?php } ?>	

	</div>
</div>
	<?php 
	
}

function lotus_beautyhoto_links_customize_register( $wp_customize ) {

/**
 * Menu Colors
 */
 
		$wp_customize->add_panel( 'lotus_beautyunter' , array(
			'title'       => __( 'Photo Links', 'lotus-beauty' ),
			'priority'   => 64,
		) );

		$wp_customize->add_section( 'lotus_beautyhoto_links' , array(
			'title'       => __( 'Options', 'lotus-beauty' ),
			'panel'       => 'lotus_beautyunter',
			'priority'   => 64,
		) );

		$wp_customize->add_setting( 'activate_photo_links', array (
            'default' => '',		
			'sanitize_callback' => 'lotus_beautyanitize_checkbox',
		) );
				
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'activate_photo_links', array(
			'label'    => __( 'Activate Photo Links on Home Pge:', 'lotus-beauty' ),
			'section'  => 'lotus_beautyhoto_links',
			'priority'    => 3,				
			'settings' => 'activate_photo_links',
			'type' => 'checkbox',
		) ) );
		
		

		$wp_customize->add_section( 'lotus_beautyhoto_links_1' , array(
			'title'       => __( 'Image 1', 'lotus-beauty' ),
			'panel'       => 'lotus_beautyunter',
			'priority'   => 64,
		) );
		
		$wp_customize->add_setting( 'lotus_beautyhoto_links_title1', array (
			'sanitize_callback' => 'sanitize_text_field',
		) );
				
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lotus_beautyhoto_links_title1', array(
			'description'    => __( 'Image Title', 'lotus-beauty' ),			
			'section'  => 'lotus_beautyhoto_links_1',
			'settings' => 'lotus_beautyhoto_links_title1',
			'type' => 'text',
		) ) );

		$wp_customize->add_setting( 'photo_image_1', array (
			'sanitize_callback' => 'esc_url_raw',
		) );
			
		$wp_customize->add_control( 
			new WP_Customize_Image_Control( $wp_customize, 'photo_image_1', 
			array(
			'label'      => __( 'Load IMG ', 'lotus-beauty' ),
			'section'    => 'lotus_beautyhoto_links_1',
			'settings'   => 'photo_image_1',
		) ) );
		
		$wp_customize->add_setting( 'lotus_beautyhoto_links_URL1', array (
			'sanitize_callback' => 'esc_url_raw',
		) );
		
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lotus_beautyhoto_links_URL1', array(
			'label'    => __( 'Enter URL', 'lotus-beauty' ),		
			'section'  => 'lotus_beautyhoto_links_1',
			'settings' => 'lotus_beautyhoto_links_URL1',
		) ) );


/*********************************************************/


		$wp_customize->add_section( 'lotus_beautyhoto_links_2' , array(
			'title'       => __( 'Image 2', 'lotus-beauty' ),
			'panel'       => 'lotus_beautyunter',
			'priority'   => 64,
		) );
		
		$wp_customize->add_setting( 'lotus_beautyhoto_links_title2', array (
			'sanitize_callback' => 'sanitize_text_field',
		) );
				
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lotus_beautyhoto_links_title2', array(
			'description'    => __( 'Image Title', 'lotus-beauty' ),			
			'section'  => 'lotus_beautyhoto_links_2',
			'settings' => 'lotus_beautyhoto_links_title2',
			'type' => 'text',
		) ) );

		$wp_customize->add_setting( 'photo_image_2', array (
			'sanitize_callback' => 'esc_url_raw',
		) );
			
		$wp_customize->add_control( 
			new WP_Customize_Image_Control( $wp_customize, 'photo_image_2', 
			array(
			'label'      => __( 'Load IMG ', 'lotus-beauty' ),
			'section'    => 'lotus_beautyhoto_links_2',
			'settings'   => 'photo_image_2',
		) ) );
		
		$wp_customize->add_setting( 'lotus_beautyhoto_links_URL2', array (
			'sanitize_callback' => 'esc_url_raw',
		) );
		
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lotus_beautyhoto_links_URL2', array(
			'label'    => __( 'Enter URL', 'lotus-beauty' ),		
			'section'  => 'lotus_beautyhoto_links_2',
			'settings' => 'lotus_beautyhoto_links_URL2',
		) ) );

/*********************************************************/


		$wp_customize->add_section( 'lotus_beautyhoto_links_3' , array(
			'title'       => __( 'Image 3', 'lotus-beauty' ),
			'panel'       => 'lotus_beautyunter',
			'priority'   => 64,
		) );
		
		$wp_customize->add_setting( 'lotus_beautyhoto_links_title3', array (
			'sanitize_callback' => 'sanitize_text_field',
		) );
				
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lotus_beautyhoto_links_title3', array(
			'description'    => __( 'Image Title', 'lotus-beauty' ),			
			'section'  => 'lotus_beautyhoto_links_3',
			'settings' => 'lotus_beautyhoto_links_title3',
			'type' => 'text',
		) ) );

		$wp_customize->add_setting( 'photo_image_3', array (
			'sanitize_callback' => 'esc_url_raw',
		) );
			
		$wp_customize->add_control( 
			new WP_Customize_Image_Control( $wp_customize, 'photo_image_3', 
			array(
			'label'      => __( 'Load IMG ', 'lotus-beauty' ),
			'section'    => 'lotus_beautyhoto_links_3',
			'settings'   => 'photo_image_3',
		) ) );
		
		$wp_customize->add_setting( 'lotus_beautyhoto_links_URL3', array (
			'sanitize_callback' => 'esc_url_raw',
		) );
		
		$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lotus_beautyhoto_links_URL3', array(
			'label'    => __( 'Enter URL', 'lotus-beauty' ),		
			'section'  => 'lotus_beautyhoto_links_3',
			'settings' => 'lotus_beautyhoto_links_URL3',
		) ) );

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

