Yes, I know the title seems a little strange. From the admin section it’s easy as pie. Just click Posts and look at the date.
On the viewing side it’s easy too, but codewise, this is a way that can let you separate your posts, or do something special to those that have been posted today, maybe add a ‘New’ graphic, or ‘Posted Today’, or something like that.
Easy to do, like this:
$post_date = mysql2date(“Ymd”, $post->post_date);
if ($post_date == date(‘Ymd’)) {
?>
<div class=”post-new”> </div>
<?php
}
In this case it’s shown in the theme I created for Percent Savings, where a ‘New’ graphic is shown on the right side of the index page if there is a new post. You can do a whole slough of things though, maybe add some reply options?
I linked the mysql2date function to the Codex, it’s useful in this, and can be used for more than just the day. Perhaps you want to highlight an entire week, or the last hour (if you have a -really- busy blog)?

















Trackbacks