Post 1 featured & 4 latest posts on custom home page

I’m new to Wordpress and created a custom home page and separate blog page, but wanted to include 5 posts on home page - one featured and four of the latest. Finally got it to work with the code below (ignore the classes - that’s just my CSS):

<?php
                        $the_slug = 'featured-post';
                        $args=array(
                                'name' => $the_slug,
                                'post_type' => 'post',
                                'post_status' => 'publish',
                                'posts_per_page' => 1
                        );
                        $postslist = get_posts( $args );
                        foreach ( $postslist as $post ) :
                          setup_postdata( $post ); ?> 
                                <div class="home-primary-post">
                                        <div class="home-primary-title"><?php the_title(); ?></div>
                                        <div class="home-primary-date"> <?php the_date(); ?></div>            
                                        <div class="home-primary-excerpt"><?php the_excerpt(); ?></div> 
                                </div>
                        <?php
                        endforeach; 
                        wp_reset_postdata();
                        ?>                                   
                 
                        <?php
                             $args = array( 'posts_per_page' => 4, 'order'=> 'ASC', 'orderby' => 'title' );
                             $postslist = get_posts( $args );
                             foreach ( $postslist as $post ) :
                               setup_postdata( $post ); ?> 
                                     <div class="home-secondary-post">
                                        <div class="home-secondary-title"><?php the_title(); ?></div>
                                        <div class="home-secondary-date"> <?php the_date(); ?></div>            
                                        <div class="home-secondary-excerpt"><?php the_excerpt(); ?></div> 
                                      </div>
                             <?php
                             endforeach; 
                             wp_reset_postdata();
                        ?>

Thanks for sharing.

Rather than having to manually set the slug to “featured-post”, you should look into sticky posts. You could return the first sticky (example is in the codex) which would enable you to update the featured post as content is added, without needing to change slug or affecting the permalink.

Oh cool - I’ll check that out. Not having to mess with the slug would definitely be nice. Thanks man!

Nice, I had totally forgotten about sticky posts.