Simple Twits
This is a Twitter plug-in for Wordpress created originally for the Ruthless Mind project. It allows you to displays your tweets as well as showcase your followers. Its pretty simple for people who just want to move on to the next task, but provides direct access to the PHP data array for the more advanced users.
How do I use this thing?
Once you’ve added the “simple-twits” folder into your Wordpress plugins folder your plug-in settings will become accessible through the “Plugins” menu.

Next you just store your username and password. The password is required to pull your followers, but its not necessary if you choose to not use that feature.

Choose the message settings. How many messages do you want to display at a time?

Set your display settings of your followers (your password is required for followers).

The fun part (basic users)
Now that everything is configured its time for the code.
To have your followers display you simply need to add this piece of PHP code to your theme:
<?php twitter_followers() ?> |
The same approach applies for the Twitter messages. Just add twitter_messages() to your theme.
<?php twitter_messages() ?> |
Lastly, if you want to add a “Follow Me” link you can add the following code:
<?php twitter_follow_me_url() ?> |
Default CSS
The following is some generic CSS that will get you up and running. Make changes as needed to fit your theme.
1 2 3 4 5 6 7 8 9 |
/*** twitter followers css ***/ #twitter_followers li { float: left; list-style: none; margin-right: 2px; } #twitter_followers a:link, #twitter_followers a:visited { border: 1px solid #000; display: inline-block; } #twitter_followers img, #twitter_followers a:link, #twitter_followers a:visited { height: 48px; width: 48px; } #twitter_followers a:active, #twitter_followers a:hover { background: #FFF; } /*** twitter messages ***/ #twitter_messages li { margin-bottom: 20px; } #twitter_messages .time { font: 11px Georgia, "Times New Roman", Times, serif; font-style: italic; margin-bottom: 5px; color: #3c3c3c; } |
The really fun part (advanced users)
twitter_follow_me_url(follow_message)
The follow_message can be anything you’d like. The default is “Follow me on Twitter,” but you can change the wording or add HTML.
<?php twitter_follow_me_url('Follow me on <em><strong>Twitter</strong></em>') ?> |
twitter_followers(true)
Adding “true” to the twitter_followers() function returns an array of data rather than print HTML. This is an example of how to work with the data array:
1 2 3 4 5 |
foreach(twitter_followers(true) as $follower)
{
$username = $follower->screen_name;
echo "<p><a href=\"http://twitter.com/$username\"><img src=\"{$follower->profile_image_url}\" alt=\"$username\" /></a></p>";
} |
twitter_messages(true)
The twitter_messages() function works just like the twitter_followers(). Simply pass it the value “true” and it will return a PHP array. This is an example of working with the returned data:
1 2 |
foreach(twitter_messages(true) as $message)
echo = "<p>{$message['text']} @ {$message['timestamp']}</p>"; |
Thats pretty much it.
The plugin is available for download here: http://wordpress.org/extend/plugins/simple-twits/