• 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>
Viewing 16 replies (of 16 total)
  • Thread Starter substitute

    (@substitute)

    Well this took toooooo long so I just used my brain and made a category-page with January 2010 and it’ll serve as my latest posts page for the time being and will force me to update it once a month.

Viewing 16 replies (of 16 total)
  • The topic ‘Recent posts loop’ is closed to new replies.