Add this code to your functions.php file:
[php]<?php
/**
* Checks to see if the post id is the most recent.
*
* @param string Post ID.
* @return boolean true/false
*
*/
function wps_check_latest( $post_id ) {
$args = array(
'numberposts' => 1,
'offset' => 0,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'publish'
);
$latestpost = get_posts( $args );
if ( $latestpost[0]->ID == $post_id )
return true;
else
return false;
}
[/php]
To use you would use like this:
[php]
global $post;
if ( wps_check_latest( $post->ID ) )
//do something
else
//do something else
[/php]