Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// [quotable]"Here's my quote."[/quotable]
// [quotable link="" class="" link_class=""]"Here's my quote."[/quotable]
// if link says 'no', use only content, no permalink
//=========================================================== TWEET THIS SHORTCODE
function quotable_shortcode( $atts, $content = null ) {
'class' => 'no_lede',
'link' => '',
'link_class' => '',
), $atts));
$return_string = '';
if(isset($content)) {
$content = strip_tags($content);
if (empty($link)) $link = get_permalink();
$return_string = "<blockquote class='$class quotable'><p class='$class'>$content<br />
<a target='_blank' class='twitter icon_btn $link_class'
title='Click to share on Twitter!'><span>Tweet This</span>
return $return_string;
add_shortcode('quotable', 'quotable_shortcode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment