I'm new to WordPress and trying to turn a website into a WordPress theme. At the bottom of the index page (static page) there is an area for the two latest posts. I have created two dummy posts on the backend to test it. When I try to display the posts on the index page, it displays the title and content of the home page rather than the content of the most recent posts.
Here's the code I wrote;
<?php $i = 0; while (have_posts() && $i < 3) : the_post(); ?> <div class="blog-cards"> <img src="<?php bloginfo('template_url'); ?>/img/highlight.jpg" alt="Blog Image"> <span class="meta"><small><?php the_date(); ?></small></span> <h3 class="blog-title"><?php the_title(); ?></h3> <p class="blog-body"><?php the_excerpt(); ?></p> </div> <?php $i++; endwhile; ?>