Support » Fixing WordPress » How to list most recently added posts?

  • Resolved pezastic

    (@pezastic)


    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?

Viewing 1 replies (of 1 total)
  • I found the answer to my own question. I merely changed “post_modified” to “modified” and now it works.

Viewing 1 replies (of 1 total)
  • The topic ‘How to list most recently added posts?’ is closed to new replies.