Skip to content

Instantly share code, notes, and snippets.

@jdhobbsuk
Last active August 29, 2015 14:17
Show Gist options
  • Save jdhobbsuk/badec38aec74476e7425 to your computer and use it in GitHub Desktop.
Save jdhobbsuk/badec38aec74476e7425 to your computer and use it in GitHub Desktop.
blockquote-shortcode.php
// Blockquote
// -------------------------------------------------------------
function my_shortcode_blockquote( $atts, $content ) {
// extract and set defaults
extract( shortcode_atts( array(
'line1' => '',
'line2' => ''
), $atts ) );
$output_string = '<blockquote>';
$output_string .= $content;
$output_string .= '<cite>';
if($line1 != ''):
$output_string .= '<strong>'.$line1.'</strong>';
endif;
if($line2 != ''):
$output_string .= '<em>'.$line2.'</em>';
endif;
$output_string .= '</cite>';
$output_string .= '</blockquote>';
return force_balance_tags($output_string);
}
add_shortcode( 'blockquote', 'my_shortcode_blockquote' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment