<?php
/**
 * Theme banner section
 *
 * @package Pawprints Blog
 */

// All Function code and function definitions go here...

$pawprints_blog_section_one = get_theme_mod('pawprints_blog_section_banner');
if ('Disable' === $pawprints_blog_section_one) {
    return;
}

// Retrieve theme modifications once
$banner_image = get_theme_mod('pawprints_blog_section_bannerimage_section');
$banner_text = get_theme_mod('pawprints_blog_section_bannerimage_section_text');
$banner_title = get_theme_mod('pawprints_blog_section_bannerimage_section_title');
$banner_url = get_theme_mod('pawprints_blog_section_bannerimage_section_url');
$banner_url_title = get_theme_mod('pawprints_blog_section_bannerimage_section_url_title');
?>

<section id="banner-section-first">
    <div class="main-banner-main">
        <?php if (!empty($banner_image)) : ?>
            <img src="<?php echo esc_url($banner_image); ?>" alt="<?php echo esc_attr($banner_title); ?>">
        <?php endif; ?>

        <?php if (!empty($banner_title) || !empty($banner_text) || !empty($banner_url)) : ?>
            <div class="text-box">
                <?php if (!empty($banner_text)) : ?>
                    <p><?php echo esc_html($banner_text); ?></p>
                <?php endif; ?>

                <?php if (!empty($banner_title)) : ?>
                    <h2><?php echo esc_html($banner_title); ?></h2>
                <?php endif; ?>

                <?php if (!empty($banner_url) && !empty($banner_url_title)) : ?>
                    <div class="theme-button">
                        <a href="<?php echo esc_url($banner_url); ?>"><?php echo esc_html($banner_url_title); ?></a>
                    </div>
                <?php endif; ?>
            </div>
        <?php endif; ?>
    </div>
</section>
