WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Display the 5 most recent posts (3 posts)

  1. Niclas
    Member
    Posted 7 years ago #

    Hi!

    I'm trying to display the five most recent posts on my page. It should display the first post in full-length and then the five most recent posts with just the title.

    The code I'm using now is:

    <?php wp_get_archives('type=postbypost&limit=10&format=html'); ?>

    It does display the five most recent posts, but it includes the one in full-length to. I don't want it to include the most recent post.

    Anyone know how to achieve this?

    thanks!
    /Niclas

  2. Kafkaesqui

    Posted 7 years ago #

    This would be the simplest option:

    http://codex.wordpress.org/Template_Tags/get_posts

    See the info there on the 'offset' parameter.

  3. Niclas
    Member
    Posted 7 years ago #

    Thanks!

    Just for the record, this is the code I used:

    <ul>
    <?php
    $myposts = get_posts('numberposts=5&offset=1&category=1');
    foreach($myposts as $post) :
    ?>
    <li><a>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.