WordPress – Static front page should show latest posts

I want to have a static front page on my WordPress and this static one should display the latest 5 posts and below that up to 6 custom meta fields. Thats why I changed the reading settings from last posts to “Static page”, because otherwise I would not have the possibility to access the custom meta fields.

How can I now include the latest 5 blogposts on my front-page and use the default post template/output.

Read More

I did it with this query:

$latest_blog_posts = new WP_Query( array( 'posts_per_page' => 5 ) );
    if ( $latest_blog_posts->have_posts() ) : while ( $latest_blog_posts->have_posts() ) : $latest_blog_posts->the_post();
        // Loop output goes here
    endwhile; endif;

Do i now have to rewrite the code for the post here completly or can I just include the post template in some way?

Thanks!

Related posts

Leave a Reply

2 comments