<?php
// Custom query for 3 posts from 'minne' category
$roti_args = array(
    'post_type' => 'post',
    'posts_per_page' => 3,
    'category_name' => 'roti',
    'orderby' => 'rand',
    'order' => 'DESC'
);

$roti_args = new WP_Query($roti_args);
?>

<section id="popular-minne" aria-labelledby="minne-heading">
    <h2 id="minne-heading">Mau 'Dholl Puri'</h2>
    <div class="foodcards-container">
        <?php if ($roti_args->have_posts()) : ?>
            <?php while ($roti_args->have_posts()) : $roti_args->the_post(); ?>
                <article id="post-<?php the_ID(); ?>" <?php post_class('foodcard'); ?>>
    <div class="post-thumbnail">
        <?php if (has_post_thumbnail()) : ?>
            <a href="<?php echo esc_url(get_permalink()); ?>" rel="bookmark">
                <?php the_post_thumbnail('medium', array(
                    'alt' => get_the_title(),
                    'width' => '200',
                    'height' => '200'
                )); ?>
            </a>
        <?php endif; ?>
    </div>

    <header class="entry-header">
        <h3 class="entry-title">
            <?php the_title(); ?>
        </h3>
    </header>

    <div class="entry-content">
        <?php the_excerpt(); ?>
    </div>

    <footer class="entry-footer">
        <a href="<?php echo esc_url(get_permalink()); ?>" class="btn" role="button">
            Read More<span class="sr-only"> about <?php echo get_the_title(); ?></span>
        </a>
    </footer>
</article>
            <?php endwhile; ?>
            <?php wp_reset_postdata(); // Reset the post data to avoid conflicts ?>
        <?php else : ?>
            <p>No roti posts found.</p>
        <?php endif; ?>
    </div>
</section>