Skip to content
drmonkeyninja edited this page Feb 12, 2012 · 5 revisions

The arc_twitter tag

Syntax

<txp:arc_twitter user="drmonkeyninja" />

Usage

Attribute Description Default Example
user Twitter user name arc_twitter username user="drmonkeyninja"
limit Maximum number of tweets to display (max. 200) 10 limit="25"
fetch Maximum number of tweets to retrieve from Twitter (max. 200)1 0 fetch="50"
retweets 1 to include retweets in the feed, 0 to exclude them 0 retweets="1"
replies 1 to include replies, 0 to exclude them from the feed 1
dateformat Format that update dates will appear as Archive date format dateformat="%b %Oe, %I:%M %p"
label Label for the top of the list no label label="My Twitter timeline"
labeltag Independent wraptag for label unset labeltag="h3"
break HTML tag (without brackets), or string, used to separate the updates li break="br"
wraptag HTML tag to be used as the wraptag, without brackets unset wraptag="ul"
class CSS class attribute for wraptag arc_twitter class="twitter"
class_posted CSS class attribute applied to span tag around posted date arc_twitter-posted

1 Twitter’s API counts the number of tweets to return before applying some of the filters, so the response can be fewer tweets than expected. To help avoid this you can set a fetch limit that is higher than the display limit that you want to output. If fetch is less than limit the latter will be used instead.

Example usage

<txp:arc_twitter user="drmonkeyninja" limit="5" wraptag="ul" break="li" dateformat="%b %Oe, %I:%M %p" />

Produces a bullet point list of the last 5 Twitter updates from drmonkeyninja’s Twitter feed with a defined date format to override the default archive date format.

The arc_twitter_search tag

Syntax

<txp:arc_twitter_search hashtags="txp" />

Usage

Attribute Description Default Example
search Comma separated list of search words unset search="txp,textpattern"
hashtags Comma separated list of hashtags to search for (not including the hash) unset hashtags="txp,textpattern"
reply Username of tweets in reply to unset reply="twitter"
mention Username of user mentioned in tweets (i.e. tweets containing @username) unset mention="twitter"
limit Maximum number of tweets to display (max. 200) 10 limit="25"
dateformat Format that update dates will appear as Archive date format dateformat="%b %Oe, %I:%M %p"
label Label for the top of the list no label
labeltag Independent wraptag for label unset
break HTML tag (without brackets), or string, used to separate the updates li
wraptag HTML tag to be used as the wraptag, without brackets unset
class CSS class attribute for wraptag arc_twitter_search
class_user CSS class attribute applied to span tag around user name arc_twitter-user
class_posted CSS class attribute applied to span tag around posted date arc_twitter-posted

Example usage

<txp:arc_twitter_search search="plugin" hashtags="txp,textpattern" limit="25" />

Produces a list of tweets containing the word ‘plugin’ and the hashtags ‘#txp’ and ‘#textpattern’. The tag will return a maximum of 25 tweets.

The arc_twitter_tweet_button tag

Outputs the Twitter tweet button (formerly <txp:arc_twitter_retweet />).

Syntax

<txp:arc_twitter_tweet_button />

Usage

Attribute Description Default Example
user Twitter user name to quote arc_twitter username user="drmonkeyninja"
url URL to tweet
text Tweet text
follow1 Suggested Twitter account to follow, for example your own A Twitter user to recommend follow1="Textpattern"
follow2 As follow1 unset
lang Language en lang="es"
count Count box position, options: none, horizontal or vertical horizontal count="none"
include_js Whether or not to include the widget JavaScript 1 include_js="0"
optimise_js Optimise the JavaScript by using a local script rather than that hosted on the Twitter site 0 optimise_js="1"
class CSS class attribute applied to the tweet button twitter-share-button

The arc_twitter_follow_button tag

Outputs the Twitter follow button (an alternative version is included in arc_twitter_intents).

Syntax

<txp:arc_twitter_follow_button />

Usage

Attribute Description Default Example
user Twitter user name to follow arc_twitter username user="drmonkeyninja"
lang Language en lang="es"
count Whether or not the follower count is shown 1 count="0"
include_js Whether or not to include the widget JavaScript 1 include_js="0"
optimise_js Optimise the JavaScript by using a local script rather than that hosted on the Twitter site 0 optimise_js="1"
class CSS class attribute applied to the follow button twitter-follow-button

arc_twitter_tweet_url

Returns the URL of the Twitter status for an article.

Syntax

<txp:arc_twitter_tweet_url />

<txp:arc_twitter_tweet_url>Link text</txp:arc_twitter_tweet_url>

Usage

Attribute Description Default Example
id Textpattern article ID current article id="1"
title Title attribute of the link unset
class CSS class attribute applied to the link unset

arc_twitter_tinyurl

Returns the shortened URL of the article used for the Twitter update.

Syntax

<txp:arc_twitter_tinyurl />

<txp:arc_twitter_tinyurl>Link text</txp:arc_twitter_tinyurl>

Usage

Attribute Description Default Example
id Textpattern article ID current article id="1"
title Title attribute of the link unset
class CSS class attribute applied to the link unset

arc_twitter_widget_js

Outputs the Twitter widget JavaScript used by the Twitter buttons and web intents. If the JavaScript has already been output somewhere else on the page then it will return nothing.

Syntax

<txp:arc_twitter_widget_js />

Usage

Attribute Description Default Example
optimise Allows for performance optimisation by locally hosting the Twitter widget JavaScript 0 optimise="1"

Caching

In order to prevent excessive repeatitive calls to the Twitter website it is recommended to cache results. Twitter limits the number of calls through the API, and continuous calls will result in Twitter closing to further requests. By default, arc_twitter caches for 30 minute intervals.

Attribute Description Default Example
caching ‘1’ to cache feed, ‘0’ to turn caching off (not recommended) 1 caching="1"
cache_dir Absolute path to the cache directory (must be writable) arc_twitter preferences
cache_time Time in minutes that the cache files are stored before being refreshed 5 cache_time="30"

The admin side of this plugin enforces caching, apart from when it is posting to Twitter (e.g. when posting or deleting an update).