<?php get_header();
if (have_posts()) {
?>
    <div class="sp-tb">
        <div class="maincontainer">
            <div class="row">
                <div class="col-lg-8">
                    <div class="single-blog single-page">
                        <img src="<?php the_post_thumbnail_url(); ?>">
                        <h4 class="single-title"><?php the_title(); ?></h4>
                        <div class="date"><i class="fa-solid fa-calendar-days"></i> <span><?php echo get_the_date(); ?></span></div>
                        <?php the_content(); ?>
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="related-blog">
                        <h4>Related Blogs</h4>
                        <div class="row">
                            <?php
                            $blog = array('post_type' => 'post', 'order' => 'ASC', 'posts_per_page' => '3');
                            $blogquery = new WP_Query($blog);
                            if ($blogquery->have_posts()) {
                                while ($blogquery->have_posts()) {
                                    $blogquery->the_post();
                            ?>
                                    <div class="col-lg-12 col-md-6 mb">
                                        <div class="blog-card">
                                            <a href="<?php the_permalink(); ?>">
                                                <div class="image">
                                                    <img src="<?php the_post_thumbnail_url(); ?>" alt="image">
                                                </div>
                                                <h5><?php the_title(); ?></h5>
                                                <div class="date"><i class="fa-solid fa-calendar-days"></i> <span><?php echo get_the_date(); ?></span></div>
                                            </a>
                                        </div>
                                    </div>
                            <?php }
                            } ?>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
<?php
}
get_footer();
?>