WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to list most recently added posts? (2 posts)

  1. pezastic
    Member
    Posted 5 years ago #

    I can't find the answer to this. Currently I am listing the most recent posts in my sidebar with this:
    `<?php
    global $post;
    $myposts = get_posts('orderby=post_modified&numberposts=5');
    foreach($myposts as $post) :
    setup_postdata($post);
    ?>`
    However, I'd like to list the most recently added posts instead, as I am adding posts that are dated a few years back and I'd like them to show in the list, instead of just the ones that are dated the most recent. How can I do that?

  2. pezastic
    Member
    Posted 5 years ago #

    I found the answer to my own question. I merely changed "post_modified" to "modified" and now it works.

Topic Closed

This topic has been closed to new replies.

About this Topic