Show Posts if is_front_page
I’ve set a static page as my front page. I’m trying to show the 2 latest posts on that page. I’ve got the code working to insert the 2 posts, but I need to some how enclose that code in an is_front_page statement.
Here’s my code for page.php:
<?php $postslist = get_posts('numberposts=2&order=ASC'); foreach ($postslist as $post) : setup_postdata($post); ?> <div> <?php the_title(); ?><br /> <?php the_date(); ?><br /> <?php the_excerpt(); ?> </div> <?php endforeach; ?>
- The topic ‘Show Posts if is_front_page’ is closed to new replies.