Skip to content

Instantly share code, notes, and snippets.

@krogsgard
Created February 12, 2012 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save krogsgard/1810326 to your computer and use it in GitHub Desktop.
Save krogsgard/1810326 to your computer and use it in GitHub Desktop.
Uses the get_the_modified_time function to created a shortcode, just like the [entry-published] shortcode in Hybrid Core
add_shortcode( 'entry-modified', 'krogs_entry_modified_shortcode' );
function krogs_entry_modified_shortcode( $attr ) {
$domain = hybrid_get_textdomain();
$attr = shortcode_atts( array( 'before' => '', 'after' => '', 'format' => get_option( 'date_format' ) ), $attr );
$modified = '<abbr class="modified" title="' . sprintf( get_the_modified_time( esc_attr__( 'l, F jS, Y, g:i a', $domain ) ) ) . '">' . sprintf( get_the_modified_time( $attr['format'] ) ) . '</abbr>';
return $attr['before'] . $modified . $attr['after'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment