Created
October 5, 2013 14:18
-
-
Save artboard-studio/e87233dda8dc1582d1da to your computer and use it in GitHub Desktop.
Twitter Feed Shortcode
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
function mb_twitter($atts, $content = null ){ | |
extract(shortcode_atts(array('count'=>'3','user'=>''), $atts)); | |
//Cache user and then return last tweeted items (3 by default) | |
$via = '<div class="tweet-via"><a href="https://twitter.com/intent/user?screen_name='.$user.'" target="_blank" rel="nofollow">@'.$user.'</a></div>'; | |
return '<div class="twitter-feed"><ul id="twitter_update_list"><li>Twitter feed loading</li></ul>'.$via.'</div><script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script> | |
<script type="text/javascript" src="https://api.twitter.com/1/statuses/user_timeline.json?screen_name='.$user.'&callback=twitterCallback2&count='.$count.'"></script>'; | |
} | |
add_shortcode('mb_twitter', 'mb_twitter'); | |
// use this shortcode [mb_tweets count=5 user="OnlineMarket"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment