NOTE: This functionality is now a part of Twitter Plugin since version 0.9.10
Still, there are differences, and you might like this one better.
Craft twig filter to expand urls, hashtags, user mentions in tweets. Works with Twitter Plugin
- Unzip file
- Place the 'tweetlinker' folder into your craft/plugins directory
- Install plugin in the Craft Control Panel under Settings > Plugins
- Install Twitter Plugin
- Fetch tweet with
craft.twitter.get
{{tweet|tweetLink}}
is the tweet with urls etc. expanded{{...|raw}}
so the link html is not escaped
{% set tweets = craft.twitter.get('statuses/user_timeline.json?screen_name=marionnewlevant&count=5') %}
{% for tweet in tweets %}
{{tweet|tweetLink|raw}}
{% endfor %}
- Use as filter
tweet|tweetLink
- Use as function
tweetLink(tweet)
- filter/function argument
newWindow
(default false): includetarget="_blank"
to open urls in new window? - filter/function argument
title
(default false): include title attribute in url?