From ceedb4ccf2220a2e632e80c5e2d4d7f2375b6c02 Mon Sep 17 00:00:00 2001 From: MickeyKay Date: Wed, 7 Jan 2015 10:23:25 -0800 Subject: [PATCH] Add blockquote shortcode --- includes/shortcodes/shortcodes.php | 78 ++++++++++++++++++++++++++---- 1 file changed, 69 insertions(+), 9 deletions(-) diff --git a/includes/shortcodes/shortcodes.php b/includes/shortcodes/shortcodes.php index b8ceddb..b5cbad2 100644 --- a/includes/shortcodes/shortcodes.php +++ b/includes/shortcodes/shortcodes.php @@ -11,8 +11,17 @@ * Shortcodes ===========================================*/ -// Fix for empty

tags around shortcodes -function trestle_shortcode_empty_paragraph_fix($content) +add_filter('the_content', 'trestle_shortcode_empty_paragraph_fix'); +/** + * Fix for empty

tags around shortcodes + * + * @since 1.0.0 + * + * @param string $content HTML content. + * + * @return string Updated content. + */ +function trestle_shortcode_empty_paragraph_fix( $content ) { $array = array ( '

[' => '[', @@ -24,8 +33,8 @@ function trestle_shortcode_empty_paragraph_fix($content) return $content; } -add_filter('the_content', 'trestle_shortcode_empty_paragraph_fix'); +add_shortcode( 'col', 'trestle_column' ); /** * Columns * @@ -36,6 +45,10 @@ add_filter('the_content', 'trestle_shortcode_empty_paragraph_fix'); * - width (one-half, one-third, etc - uses native Genesis column classes in style.css) * - first (used to specify the first column in a row) * - no-list-margin (will cause contained list elements to collapse as one on mobile sizes) + * + * @param array $atts Shortcode attributes. + * + * @return string Shortcode output. */ function trestle_column( $atts, $content = null ) { extract( shortcode_atts( array( @@ -43,13 +56,18 @@ function trestle_column( $atts, $content = null ) { ), $atts ) ); return '

' . do_shortcode( $content ) . '
'; } -add_shortcode( 'col', 'trestle_column' ); + + +add_shortcode( 'button', 'trestle_button' ); /** * Button * - * Example: - * [button href="url" title="title" target="target" class="class"]Text[/button] + * Example: [button href="url" title="title" target="target" class="class"]Text[/button] + * + * @param array $atts Shortcode attributes. + * + * @return string Shortcode output. */ function trestle_button( $atts, $content = null ) { extract( shortcode_atts( array( @@ -60,13 +78,17 @@ function trestle_button( $atts, $content = null ) { ), $atts ) ); return '' . do_shortcode( $content ) . ''; } -add_shortcode( 'button', 'trestle_button' ); + +add_shortcode( 'date', 'trestle_date' ); /** * Date * * Example: [date format="M d, Y"] - * + * + * @param array $atts Shortcode attributes. + * + * @return string Shortcode output. */ function trestle_date( $atts ) { extract( shortcode_atts( array( @@ -79,4 +101,42 @@ function trestle_date( $atts ) { return date( $format ); } -add_shortcode( 'date', 'trestle_date' ); + +add_shortcode( 'blockquote', 'igg_blockquote_shortcode' ); +/** + * Blockquote + * + * Example: [blockquote citation=""]Content[/blockquote] + * + * @since 1.2.0 + * + * @param array $atts Shortcode attributes. + * + * @return string Shortcode output. + */ +function igg_blockquote_shortcode( $atts, $content = null ) { + + $atts = shortcode_atts( array( + 'citation' => '', + ), $atts ); + + ob_start(); ?> + +
+ + + + + + + - + + +
+ +