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

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

        // Render advertisement section now.
        enlightme_pro_render_advertisement_section();
    }
endif;

if ( ! function_exists( 'enlightme_pro_render_advertisement_section' ) ) :
  /**
   * Start advertisement section
   *
   * @return string advertisement content
   * @since enlightme Pro 1.0.0
   *
   */
   function enlightme_pro_render_advertisement_section() {
        $options = enlightme_pro_get_theme_options();
       
        ?>
        <div id="enlightme_pro_advertisement_section">

          <?php if( !empty( $options['advertisement_image'] ) && !empty( $options['advertisement_link'] ) ){ ?>
          <div id="add" class="page-section wrapper" style="background-image:url('<?php echo esc_url( $options['advertisement_image'] ); ?>')">
            <a href="<?php echo esc_url( $options['advertisement_link'] ); ?>" class="post-thumbnail-link"></a>
          </div>
          <?php } ?>

        </div>
    <?php }
endif;