<?php
/**
 * Theme Category Section
 *
 * @package Pawprints Blog
 */

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

$pawprints_blog_section_one = get_theme_mod('pawprints_blog_section1_enable');
if ('Disable' === $pawprints_blog_section_one) {
    return;
}
?>

<section id="cat-section-one" class="category-section-one">
    <div class="container-fluid">
        <div class="section-heading-main">
            <?php if (get_theme_mod('pawprints_blog_working_hours_section_title', true) != '') { ?>
                <h3><?php echo esc_html(get_theme_mod('pawprints_blog_working_hours_section_title')); ?></h3>
                <p><?php echo esc_html(get_theme_mod('pawprints_blog_working_hours_section_text')); ?></p>
            <?php } ?>
        </div>
        <div class="row">
            <?php 
            for ($i = 1; $i <= 6; $i++) {
                // Check if category title is set before rendering the column
                $category_title = get_theme_mod('pawprints_blog_category_title' . $i);
                if (!empty($category_title)) {
            ?>
                <div class="col-lg-2 col-md-3 col-6">
                    <div class="blog-cat-box">
                        <?php 
                        // Check if category image is set before rendering
                        $category_image = get_theme_mod('pawprints_blog_section_category_image' . $i);
                        if (!empty($category_image)) { ?>
                            <img src="<?php echo esc_url($category_image); ?>" alt="<?php echo esc_attr($category_title); ?>">
                        <?php } ?>

                        <?php 
                        // Check if category URL is set before rendering the link
                        $category_url = get_theme_mod('pawprints_blog_category_title_url' . $i);
                        if (!empty($category_url)) { ?>
                            <a href="<?php echo esc_url($category_url); ?>">
                                <h4 class="day-content"><?php echo esc_html($category_title); ?></h4>
                            </a>
                        <?php } else { ?>
                            <h4 class="day-content"><?php echo esc_html($category_title); ?></h4>
                        <?php } ?>
                    </div>
                </div>
            <?php 
                } 
            } 
            ?>
        </div>
    </div>
</section>
