Created
July 7, 2016 21:07
-
-
Save chasereeves/1a5f383bc453ad1cee7d3a1d916cacd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [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