When a visitor comes to your Drupal websites and there are lots of posts that are displayed as list of links, it may be difficult for the visitor to say if they have already read that post or not, or simply if you may want to highlight the latest posts with say X days as NEW so that it catches attention. In order to say the word NEW next to a post in Drupal you can use the following snippet page.tpl file of your theme and modify the title as shown below. Here X is set to 30, so any post that is created with 30 days would have display the word NEW next to the title.
<?php
function ago($timestamp){
$difference = time() - $timestamp;
$text = format_interval($difference, 1) ;
return $text;
}
$ago = ago($variables['node']->created);
if ($ago < 30)
{
$title = $title .'<span bgcolor="red"> [New]</span>';
}
?>