I am learning about WordPress development. I ran into an issue but could not figure out what am I doing wrong
I want to show all of the posts on a page using a custom template. I am following this tutorial https://developer.wordpress.org/themes/basics/the-loop/#blog-archive
So far:
1: I have created a custom page template with the name of "homepage"
2: I have created a page and assigned page template "homepage" and set that page as homepage from the settings panel.
3: In the page template, I have added the below code
/*
* Template Name: Homepage
* Template Post Type: page
*/
get_header();
if ( have_posts() ) :
while ( have_posts() ) : the_post();
the_title( '<h2 style="color:#fff;">', '</h2>' );
the_post_thumbnail();
the_excerpt();
endwhile;
else:
_e( 'Sorry, no posts matched your criteria.', 'textdomain' );
endif;
get_footer();
?>
The above code only displays the current page title and featured image, NOT all of the posts title and featured image.
As per the documentation I am doing everything right, but on the frontend, it is not showing all of the posts, Any idea what I am doing wrong?