• Is there any way at all (plugin, hack, etc.) to get WordPress to identify whether the current post is the latest one published?

    This needs to work on single post pages and ignore posts set to be automatically published at a later date.

    Any ideas folks?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    You could just get the latest published post and compare the ID numbers.

    $latestposts = get_posts('numberposts=1');
    $latestpost = $latestposts[0];
    if (get_the_ID() == $latestpost->ID) {
    // this is the latest post
    } else {
    // it's not
    }
    Thread Starter robomilk

    (@robomilk)

    Took a bit of hacking together with my existing code, but it worked. Thanks 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘if latest_post?’ is closed to new replies.