Make WordPress Core

Ticket #1836: useful.php

File useful.php, 980 bytes (added by error, 18 years ago)

Implements time updated template functions

Line 
1<?php
2/*
3Plugin Name: Incredibly Useful Functions
4Plugin URI: http://www.ioerror.us/
5Version: 0.0.1
6Author: Michael Hampton
7Author URI: http://error.wordpress.com/
8Description: Stuff that really should be in the WordPress core but isn't. These will allow you to enhance your theme, among other things.
9License: GPL
10*/
11
12// Functions for when a post was last modified/updated
13function the_modified_time($d = '') {
14        echo apply_filters('the_time', get_the_modified_time($d), $d);
15}
16
17function get_the_modified_time($d = '') {
18        if ('' == $d)
19                $the_time = get_post_modified_time(get_settings('time_format'));
20        else
21                $the_time = get_post_modified_time($d);
22        return apply_filters('get_the_time', $the_time, $d);
23}
24
25function get_post_modified_time( $d = 'U', $gmt = false ) { // returns timestamp
26        global $post;
27
28        if ($gmt)
29                $time = $post->post_modified_gmt;
30        else
31                $time = $post->post_modified;
32        $time = mysql2date($d, $time);
33        return apply_filters('get_the_time', $time, $d, $gmt);
34}