2012
[lastupdated format="l, F j, Y"] => Friday, January 11, 2012
[lastupdated format="G:i a (T)"] => 7:02 pm (EST)
[lastupdated format="Y-m-d_h:i:s"] => 2012-01-11_19:02:44
[lastupdated format="l, F j, Y \a\t G:i A" => Friday, January 11, 2012 at 7:02 PM
[lastupdated before="Last update:"] => Last update: Jan-11-2012
[lastupdated format="l, F j, Y" before="This page hasn't been updated since" after="!"] =>
This page hasn't been updated since Friday, January 11, 2012!
*/
// variables
$comment_tag = '
';
// shortcode echo function
function last_updated_shortcode( $atts ) {
extract( shortcode_atts( array( 'format' => 'F j, Y \a\t G:i a', 'before' => 'Last updated:', 'after' => '' ), $atts ) ); // extract optional format argument
return $comment_tag . the_modified_date( $format, $before . ' ', $after, 0 );
}
// hooks and filters
$shortcodes = array( 'lastupdate', 'lastupdated' ); // add shortcode triggers to array
foreach( $shortcodes as $shortcode ) add_shortcode( $shortcode, 'last_updated_shortcode' ); // create shortcode for each item in $shortcodes
?>