Created
April 27, 2019 15:27
-
-
Save thezenmonkey/e04d1fbcc92b0a39844d3d92c4e7f18b to your computer and use it in GitHub Desktop.
Simple Shortcode for Display Post Date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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