Using post_modified to check for recent updates
-
Hi,
I’ve been working on a function in the sidebar, but I seem to be stuck. The idea is as follows – I have a set of pages which I update, more or less frequently. I’d like to have a little “new” image or legend, next to the pages I updated less than eg. 10 days ago.
Example
————–
Pages:
About
Photos (new)
FilesI’ve managed to mock up some code that checks a date, compare it to a date (10 days ago) and display a gif image or not, depending on the result. I’ve placed this in /wp-include/classes.php around line 520 and it goes like this:
`$today = current_time(‘timestamp’, 1);
$offset = $today – 864000; // 10 days offset
*MISSING VARIABLE, $last_modified*
$nice_time = substr($last_modified, 0, 10); //just display the date
$aDate = explode(“-“,$nice_time); //split the date in vars
$unixtime = mktime(0, 0, 0, $aDate[1], $aDate[2], $aDate[0]); //create epoch timestamp of the dateif ( $unixtime > $offset ) { //
$do = “<img src=\”new.gif\”>”;
`
It works – apart from the missing variable. I need to fetch the value of “last_modified”. I could do that with a straight forward mysql get, but that seems as bad practice, as the database connections are going on elsewhere.Does anyone know of a good approach to this? Or maybe there’s already a plugin that does this? The closest variable I could get a hold on was $last_post_modified, but that’s returns the date of the latest modified post of all posts.. sigh!
Thanks in advance for input and/or thoughts.
- The topic ‘Using post_modified to check for recent updates’ is closed to new replies.