Skip to content

Instantly share code, notes, and snippets.

@thezenmonkey
Created April 27, 2019 15:27
Show Gist options
  • Save thezenmonkey/e04d1fbcc92b0a39844d3d92c4e7f18b to your computer and use it in GitHub Desktop.
Save thezenmonkey/e04d1fbcc92b0a39844d3d92c4e7f18b to your computer and use it in GitHub Desktop.
Simple Shortcode for Display Post Date
function get_post_date( $atts ) {
$a = shortcode_atts( array(
'format' => $atts['format']
), $atts );
if ( array_key_exists("format",$a) ) {
return get_the_date($a['format']);
} else {
return get_the_date('m dd, y');
}
}
add_shortcode( 'post_date', 'get_post_date' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment