Recent posts loop
-
Hi
For some reasons I can’t get my theme to display my latest posts correctly, so I figure I’d do a page with my latest posts.
I found this code to create a loop to do so, but it returns an empty page. What else should I do apart from creating a new page template with that loop inside?
Thanks<h3>Recent Articles</h3> <ul> <?php $recentPosts = new WP_Query(); $recentPosts->query('showposts=5'); ?> <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?> <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li> <?php endwhile; ?> </ul>
- The topic ‘Recent posts loop’ is closed to new replies.