<?php
/**
 * featured section
 *
 * This is the template for the content of featured section
 *
 * @package Theme Palace
 * @subpackage Charity Give
 * @since Charity Give 1.0.0
 */
if ( ! function_exists( 'charity_give_add_featured_section' ) ) :
    /**
    * Add featured section
    *
    *@since Charity Give 1.0.0
    */
    function charity_give_add_featured_section() {
        $options = charity_give_get_theme_options();
        // Check if featured is enabled on frontpage
        $featured_enable = apply_filters( 'charity_give_section_status', true, 'featured_section_enable' );

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

        // Render featured section now.
        charity_give_render_featured_section();
    }
endif;


if ( ! function_exists( 'charity_give_render_featured_section' ) ) :
  /**
   * Start featured section
   *
   * @return string featured content
   * @since Charity Give 1.0.0
   *
   */
   function charity_give_render_featured_section( $content_details = array() ) {
    $options = charity_give_get_theme_options();
    ?>
        <div id="charity_give_featured_section" class="page-section">
            <?php if ( is_customize_preview()):
                charity_give_section_tooltip( 'charity_give_featured_section' );
            endif; ?>
            <div class="wrapper">
                <?php if ( !empty( $options['donation_sub_title'] ) || !empty( $options['donation_title'] ) ) : ?>
                    <div class="section-header">
                        <?php if ( !empty( $options['featured_title'] ) ) : ?>
                            <h2 class="section-title"><?php echo esc_html( $options['featured_title'] ); ?></h2>
                        <?php endif; ?>
                        <?php if ( !empty( $options['featured_description'] ) ) : ?>
                            <p><?php echo esc_html( $options['featured_description'] ); ?></p>
                        <?php endif; ?>
                    </div><!-- .section-header -->
                <?php endif; ?>

                <?php if ( !empty( $options['featured_btn_text'] ) ) : ?>
                    <div class="read-more">
                        <a href="<?php echo esc_url( $options['featured_btn_url'] ); ?>" class="btn"><?php echo esc_html( $options['featured_btn_text'] ); ?></a>
                    </div><!-- .read-more -->
                <?php endif; ?>
            </div><!-- .wrapper -->
        </div><!-- #charity_give_featured_section -->
    <?php
    }
endif;
