WordPress.org

Make WordPress Core

Changeset 908


Ignore:
Timestamp:
02/22/04 03:28:46 (12 years ago)
Author:
michelvaldrighi
Message:

added get_lastpostmodified()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r906 r908  
    107107    } 
    108108    return $lastpostdate; 
     109} 
     110 
     111function get_lastpostmodified() { 
     112    global $tableposts, $cache_lastpostmodified, $use_cache, $pagenow, $wpdb; 
     113    if ((!isset($cache_lastpostmodified)) OR (!$use_cache)) { 
     114        $time_difference = get_settings('time_difference'); // for some weird reason the global wasn't set anymore? 
     115        $now = date("Y-m-d H:i:s",(time() + ($time_difference * 3600))); 
     116 
     117        $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $tableposts WHERE post_modified <= '$now' AND post_status = 'publish' ORDER BY post_modified DESC LIMIT 1"); 
     118        $cache_lastpostmodified = $lastpostmodified; 
     119    } else { 
     120        $lastpostmodified = $cache_lastpostmodified; 
     121    } 
     122    return $lastpostmodified; 
    109123} 
    110124 
Note: See TracChangeset for help on using the changeset viewer.