diff --git a/includes/shortcodes/shortcodes.php b/includes/shortcodes/shortcodes.php index 1c9cb09..3463e3f 100644 --- a/includes/shortcodes/shortcodes.php +++ b/includes/shortcodes/shortcodes.php @@ -18,7 +18,7 @@ function trestle_shortcode_empty_paragraph_fix($content) '

[' => '[', ']

' => ']', ']
' => ']' - ); + ); $content = strtr($content, $array); @@ -40,7 +40,7 @@ add_filter('the_content', 'trestle_shortcode_empty_paragraph_fix'); function trestle_column( $atts, $content = null ) { extract( shortcode_atts( array( 'class' => '', - ), $atts ) ); + ), $atts ) ); return '
' . do_shortcode( $content ) . '
'; } add_shortcode( 'col', 'trestle_column' ); @@ -56,13 +56,13 @@ function trestle_button( $atts, $content = null ) { 'href' => '#', 'title' => '', 'class' => '', - ), $atts ) ); + ), $atts ) ); return '' . do_shortcode( $content ) . ''; } add_shortcode( 'button', 'trestle_button' ); /** - * Buttons + * Button * * Example: * [button href="url" title="title" target="target" class="class"]Text[/button] @@ -73,7 +73,26 @@ function trestle_button( $atts, $content = null ) { 'target' => '', 'title' => '', 'class' => '', - ), $atts ) ); + ), $atts ) ); return '' . do_shortcode( $content ) . ''; } add_shortcode( 'button', 'trestle_button' ); + +/** + * Date + * + * Example: [date format="M d, Y"] + * + */ +function trestle_date( $atts ) { + extract( shortcode_atts( array( + 'format' => 'M d, Y', + ), $format ) ); + + if ( ! $format ) { + $format = 'M d, Y'; + } + + return date( $format ); +} +add_shortcode( 'date', 'trestle_date' );