This file is a documention for the plugin Juiz Last Tweet Widget.
It will be updated each time with the plugin features.
Please, note that this documentation concerne all versions of the plugin. Read the "since" mention on each feature.
You like this plugin and want support it ?
Donate
Tweet it
If you need to use custom styles for your embedded tweets :
/* The big container */
.juiz_last_tweet_widget { }
/* The list of tweets and "follow us" container */
.juiz_last_tweet_inside { }
/* The list of tweets */
.juiz_last_tweet_tweetlist { }
/* The user avatar */
.juiz_last_tweet_widget .user_avatar { }
/* The user avatar link */
.juiz_last_tweet_widget .user_avatar a { }
/* The user avatar image */
.juiz_last_tweet_widget .user_avatar img { }
/* A tweet (since 1.1.5) */
.juiz_last_tweet_item { }
/* Position of a tweet (since 1.2.2) */
.jltw_item_first { }
.jltw_item_last { }
/* if is alone */
.jltw_item_alone { }
/* if not first or last one */
.jltw_item_2 { }
.jltw_item_3 { }
etc…
/* The tweet content */
.juiz_lt_content { }
/* The part after the tweet content (since 1.1.5) */
juiz_last_tweet_footer_item { }
/* The links inside a tweet */
.juiz_last_tweet_tweetos { }
.juiz_last_tweet_hastag { }
.juiz_last_tweet_url { }
/* The container of action links */
.juiz_action_links { }
/* The different action links */
.juiz_al_reply { }
.juiz_al_retweet { }
.juiz_al_fav { }
/* The tweet metadata */
.juiz_last_tweet_metadata { }
/* The source */
.juiz_ltw_source { }
/* The baseline */
.juiz_last_tweet_follow_us { }
/* The "follow" word */
.juiz_ltw_follow { }
/* The username link */
.juiz_ltw_username { }
/* The "on Twitter" words */
.juiz_ltw_ontwitter { }
You can improve your CSS editions by using Firebug plugin.
This plugin has a Shortcode, a kind of BBcode, that allows you to display this widget where you want.
This shortcode uses the keyword jltw
(Juiz Last Tweet Widget), a particular word to oust any conflict with other plugins.
You can use the keyword tweets
, also. (since 1.2.0)
[jltw]
or since 1.2.0
[tweets]
Used in a post, this shortcode display the widget.
Morever, options are available. The list of options is the following :
username
: by default, my own twitter account ('geoffrey_crofte')nb
: by default '1'avatar
: by default 'false' (since 1.1.3 default is '0')cache
: by default '0'transition
: by default 'false' (since 1.1.3 default is '0')delay
: by default '0'links
: by default 'false' (since 1.1.3 default is '0')So, you need to change the username
, at least ;)
[jltw username="your-account" nb="3" avatar="true"]
This sample of code show the 3
last tweets of the Twitter account named "your-account
". It display the Twitter avatar (note: you can write avatar="something"
, it works).
[jltw username="your-account" nb="3" avatar="1" transition="1" delay="7" cache="3600" links="1"]
This sample does the same as the previous sample, it adds a slideshow with a delay of 7 seconds to display the 3 tweets one by one. A cache of 3600 seconds (1 hour) is used to maintain the speed of the page. Action links (retweet, reply, favorite) are displayed below each tweet.
Note: if you used the previous version of this shortcode, the version 1.1.3 needs 0 and 1 instead of False and True values respectively. Thanks.
You can't desactivate default CSS when the widget is displayed with a shortcode. You'll need to overwrite it by using your own CSS file.
Template functions allow you to display list of tweets inside any theme template you need.
There are two functions: jltw($args)
and get_jltw($args)
Example of use:
<div class="my_tweets_block">
<?php
/* your parameters */
$jltw_args = array(
'username' => 'geoffrey_crofte',
'nb_tweets' => 1,
'avatar' => false,
'cache' => 120,
'transition' => false,
'delay' => 8,
'links' => true
);
/* display widget */
jltw($jltw_args);
?>
</div>
jltw()
makes an echo
, if you need to save data in a variable, use get_jltw()
.
Example of use:
<?php
/* your parameters */
$jltw_args = array(
'username' => 'creativejuiz',
'nb_tweets' => 2,
'avatar' => true,
'cache' => 1600,
'transition' => true,
'delay' => 10,
'links' => false
);
/* set variable */
$list_of_tweets = get_jltw($jltw_args);
/* more later */
echo $list_of_tweets;
?>
Since 1.2.0 you can use the_tweets( $args )
and get_the_tweets( $args )
instead of jltw( $args )
and get_jltw( $args )
This plugin allows you to change some parts of its structure without broke the core.
The following samples of code can be inserted in the functions.php file.
In general, be careful when using several occurrences of this widget. Hooks presented here will apply to all occurrences simultaneously!
juiz_ltw_list_container_tag
Change the tag of the list container (<ul>
) by another, for example:
<?php
if( !function_exists('replacing_by_div')) {
function replacing_by_div() {
return 'div';
}
}
add_filter('juiz_ltw_list_container_tag', 'replacing_by_div');
?>
juiz_ltw_each_item_tag
Change the tag of each item (tweet) (<li>
) by another, for example:
<?php
if( !function_exists('replacing_by_div')) {
function replacing_by_div() {
return 'div';
}
}
add_filter('juiz_ltw_each_item_tag', 'replacing_by_div');
?>
juiz_ltw_user_avatar
Add things around avatar, or other manipulations using this hook. Example:
<?php
if( !function_exists('add_username_under_avatar')) {
function add_username_under_avatar($avatar) {
$new_content = $avatar.'<span class="avatar_username">@my_username</span>';
return $new_content;
}
}
add_filter('juiz_ltw_user_avatar', 'add_username_under_avatar');
?>
juiz_ltw_user_avatar_attr
You can also manipulate all the avatar attributes by using this hook. Example:
<?php
if( !function_exists('change_some_avatar_attr')) {
function change_some_avatar_attr($avatar_attr) {
// existing attributes
$avatar_attr['title'] = __('Web expert on Twitter');
$avatar_attr['src'] = '/my-own-avatar.png';
$avatar_attr['alt'] = 'John Smith';
$avatar_attr['width'] = '30';
$avatar_attr['height'] = '30';
// adding attributes
$avatar_attr['attrs'] = array(
'id' => 'jltw_avatar',
'data-custom' => 'my-data'
);
return $avatar_attr;
}
}
add_filter('juiz_ltw_user_avatar_attr', 'change_some_avatar_attr');
?>
juiz_ltw_each_tweet
Add things around each tweet, or other manipulations using this hook. Example:
<?php
if( !function_exists('add_arrow_before_tweet')) {
function add_arrow_before_tweet($a_tweet) {
$new_content = preg_replace(
'#<span class="juiz_lt_content">#',
'<span class="juiz_lt_content">→',
$a_tweet);
return $new_content;
}
}
add_filter('juiz_ltw_each_tweet', 'add_arrow_before_tweet');
?>
juiz_ltw_content
Add things around the widget container. Example:
<?php
if( !function_exists('see_more_tweets_on')) {
function see_more_tweets_on($tweets_block) {
$new_content = '<a href="http://twitter.com/my_username">'.
__('See more tweets on Twitter').
'</a>'.$tweets_block;
return $new_content;
}
}
add_filter('juiz_ltw_content', 'see_more_tweets_on');
?>
juiz_ltw_time_ago
Change the content of the "time ago" part of code or, with the same idea, delete, replace, or add content before and after "time ago" content.
Example:
<?php
if( !function_exists('see_more_tweets_link')) {
function see_more_tweets_link($time_ago) {
$time_ago['before'] = '<span>';
$time_ago['content'] = __('See the status', 'juiz_ltw');
$time_ago['after'] = __('on Twitter', 'juiz_ltw') . '</span>';
return $time_ago;
}
}
add_filter('juiz_ltw_time_ago', 'see_more_tweets_link');
?>
juiz_ltw_target_attr
Change the '_self' default target value for all the links (almost, see next hook) generated by the Juiz Last Tweet Widget plugin
Example:
<?php
if( !function_exists('change_ltw_target_attr')) {
function change_ltw_target_attr($target) {
return '_blank';
}
}
add_filter('juiz_ltw_target_attr', 'change_ltw_target_attr');
?>
juiz_ltw_target_action_links_attr
Change the '_self' default target value for the optional action links below each tweet
Example:
<?php
if( !function_exists('change_ltw_target_attr_for_action_links')) {
function change_ltw_target_attr_for_action_links($target) {
return '_blank';
}
}
add_filter('juiz_ltw_target_action_links_attr', 'change_ltw_target_attr_for_action_links');
?>
juiz_ltw_twitter_feed_not_loadable
(since 1.1.5)Change the "The RSS feed for this twitter account is not loadable for the moment." error message
Example:
<?php
if( !function_exists('change_juiz_ltw_twitter_feed_not_loadable')) {
function change_juiz_ltw_twitter_feed_not_loadable($target) {
return 'Tweets coming soon…';
}
}
add_filter('juiz_ltw_twitter_feed_not_loadable', 'change_juiz_ltw_twitter_feed_not_loadable');
?>
juiz_ltw_twitter_has_a_problem
(since 1.1.5)Change the "Twitter has a problem with your RSS feed…" error message
Example:
<?php
if( !function_exists('change_juiz_ltw_twitter_has_a_problem')) {
function change_juiz_ltw_twitter_has_a_problem($target) {
return ''; // to remove this sentence for example
}
}
add_filter('juiz_ltw_twitter_has_a_problem', 'change_juiz_ltw_twitter_has_a_problem');
?>
jltw_remove_follow_us_line
(since 1.3.0)Remove the "follow us" part of code (bird and message)
Example:
<?php
if( !function_exists('jltw_remove_follow_us')) {
function jltw_remove_follow_us() {
return true; // true remove the element
}
}
add_filter('jltw_remove_follow_us_line', 'jltw_remove_follow_us');
?>
jltw_remove_metadata
(since 1.3.0)Remove the "date an source" part of code
Example:
<?php
if( !function_exists('jltw_remove_meta')) {
function jltw_remove_meta() {
return true; // true remove the element
}
}
add_filter('jltw_remove_metadata', 'jltw_remove_meta');
?>