Advertisement
chrishajer

Add date shortcode with format and timestamp

Aug 8th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. // http://www.gravityhelp.com/forums/topic/user-notification-with-future-date
  2. if ( !function_exists('date_shortcode') ) {
  3.     function date_shortcode( $atts ) {
  4.         extract( shortcode_atts( array(
  5.             'format' => 'l jS \of F Y',
  6.             'timestamp' => 'now'
  7.         ), $atts ) );
  8.         return date( $format, strtotime( $timestamp ) );
  9.     }
  10.     add_shortcode( 'date', 'date_shortcode' );
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement