<?php
/**
 * download section
 *
 * This is the template for the content of download section
 *
 * @package Theme Palace
 * @subpackage enlightme Pro
 * @since enlightme Pro 1.0.0
 */
if ( ! function_exists( 'enlightme_pro_add_download_section' ) ) :
    /**
    * Add download section
    *
    *@since enlightme Pro 1.0.0
    */
    function enlightme_pro_add_download_section() {
        $options = enlightme_pro_get_theme_options();
        // Check if download is enabled on frontpage
        $download_enable = apply_filters( 'enlightme_pro_section_status', true, 'download_section_enable' );


        if ( true !== $download_enable ) {
            return false;
        }

        // Render download section now.
        enlightme_pro_render_download_section();
    }
endif;

if ( ! function_exists( 'enlightme_pro_render_download_section' ) ) :
  /**
   * Start download section
   *
   * @return string download content
   * @since enlightme Pro 1.0.0
   *
   */
   function enlightme_pro_render_download_section() {
        $options = enlightme_pro_get_theme_options();
        ?>

        <div id="enlightme_pro_download_section">

             <div id="download" class="same-background page-section">
                <div class="wrapper">
                <?php if ( is_customize_preview()):
                enlightme_pro_section_tooltip( 'download' );
                endif; ?>
                    <div class="section-header">
                       <?php if ( !empty( $options['download_sub_title'] ) ): ?>
                            <p class="section-subtitle"><?php echo esc_html( $options['download_sub_title'] ); ?></p>
                        <?php endif ?>
                        <?php if ( !empty( $options['download_title'] ) ): ?>
                            <h2 class="section-title"><?php echo esc_html( $options['download_title'] ); ?></h2>
                        <?php endif ?>
                    </div><!-- .section-header -->

                    <div class="section-content">
                        <?php if ( !empty( $options['download_playstore_link'] ) && !empty( $options['download_playstore_image'] ) ): ?>
                            <a href="<?php echo esc_url(  $options['download_playstore_link'] ); ?>" title="play-store"><img src="<?php echo esc_url(  $options['download_playstore_image'] ); ?>"></a>
                        <?php endif ?>
                        
                         <?php if ( !empty( $options['download_appstore_link'] ) && !empty( $options['download_appstore_image'] ) ): ?>
                            <a href="<?php echo esc_url(  $options['download_appstore_link'] ); ?>" title="app-store"><img src="<?php echo esc_url(  $options['download_appstore_image'] ); ?>"></a>
                        <?php endif ?>
                        
                    </div>
                </div><!-- .wrapper -->
            </div><!-- #download -->

        </div>
        
    <?php }
endif;