That should be possible by modifying the Loop in your theme’s index.php template file but how would you define “new”?
Thread Starter
P
(@inkedkoi)
I’d like to have the post title, and then when I publish a new post a little image that says “New” would appear beside the title.
I would have to be able to give it a period of time that the image of “New” beside the post title, but I haven’t the faint idea what code I would need to do to make something like this work
I’ve previously used something like:
/* Add span to title on newly posted posts/pages Requires my_is_new() */
function my_highlight_new($title) {
global $post, $my_options;
if( !is_attachment() && in_the_loop() ) $title .= my_is_new();
return $title;
}
add_action('the_title', 'my_highlight_new');
/*
Determine if a given post/page can be classed as 'new'. Used by my_highlight_new() */
function my_is_new() {
global $post, $my_options;
$diff = date('U') - get_the_time('U', $post);
if ( $diff < 604800 ) return ' <span class="new"></span>'; // default: 1 week
}
in a theme’s functions,php file and then used CSS to add an image on the class .new
.