1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Incredibly Useful Functions |
---|
4 | Plugin URI: http://www.ioerror.us/ |
---|
5 | Version: 0.0.1 |
---|
6 | Author: Michael Hampton |
---|
7 | Author URI: http://error.wordpress.com/ |
---|
8 | Description: Stuff that really should be in the WordPress core but isn't. These will allow you to enhance your theme, among other things. |
---|
9 | License: GPL |
---|
10 | */ |
---|
11 | |
---|
12 | // Functions for when a post was last modified/updated |
---|
13 | function the_modified_time($d = '') { |
---|
14 | echo apply_filters('the_time', get_the_modified_time($d), $d); |
---|
15 | } |
---|
16 | |
---|
17 | function 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 | |
---|
25 | function 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 | } |
---|