Create a gist now

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 ) {
extract(shortcode_atts(array(
'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'
href='https://twitter.com/intent/tweet?text=$content&url=$link&via=fizzle'
title='Click to share on Twitter!'><span>Tweet This</span>
</a></p></blockquote>";
}
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