post_date_gmt; $mod_date = $post->post_modified_gmt; } else { $post_date = $post->post_date; $mod_date = $post->post_modified; } if('' == $format) { $format = get_settings('date_format') .' @ ' .get_settings('time_format'); } $last_updated = mysql2date($format, $mod_date); if($display && mysql2date($format, $post_date) != mysql2date($format, $mod_date)) { echo $before . $last_updated . $after; } else { return $last_updated; } } // Change the default ordering function EM_order_by_modified($default){ if(is_feed() && get_option('EM_feedorder')){ return "post_modified DESC"; } elseif(get_option('EM_blogorder') && !is_admin()){ return "post_modified DESC"; } return $default; } add_filter('posts_orderby', 'EM_order_by_modified'); // If editing is "minor" get the post_modified first of the post updata function EM_check($id){ global $wpdb, $EM_query; if($_POST['newedition'] != 1){ $modified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE ID = $id AND post_status != 'draft'"); if($modified){ $modified_gmt = get_gmt_from_date($modified); $EM_query = "UPDATE $wpdb->posts SET post_modified = '$modified', post_modified_gmt = '$modified_gmt' WHERE ID = $id"; } } } // First post updata "hook" if(is_numeric($_POST['post_ID']) && $_POST['action'] == 'editpost') EM_check($_POST['post_ID']); // Update the old post_modified if the editing is "minor" function EM_updata(){ global $wpdb, $EM_query; if($EM_query) $wpdb->query($EM_query); } add_action('save_post','EM_updata'); /* TEMPLATE */ function EM_menu(){ ?>

Editing manager

Option updated successfully.

'; }elseif($_POST['EM_reset']){ $wpdb->query("UPDATE $wpdb->posts SET post_modified = post_date, post_modified_gmt = post_date_gmt"); echo '

Option updated successfully.

'; } ?>

Editing Options

Reset all post modified date

Useful to starting.

Sorting options