Using the following snippet, one can display Twitter followers image list.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <?php //replace $options['twitter'] with the twitter Username you want to use. ?> <?php $xmlfollowersUrl = 'http://api.twitter.com/1/statuses/followers/'.$options['twitter'].'.xml'; if (file_exists(WP_CONTENT_DIR.'/uploads/twitter_followers.xml')) { $data = unserialize(file_get_contents(WP_CONTENT_DIR.'/uploads/twitter_followers.xml')); if ($data['timestamp'] > time() - 120 * 60) { $twitter_followers = $data['twitter_result']; } } if (!$twitter_followers) { // cache doesn't exist or is older than 10 mins $twitter_followers = file_get_contents($xmlfollowersUrl); // or whatever your API call is $data = array ('twitter_followers' => $twitter_followers, 'timestamp' => time()); file_put_contents(WP_CONTENT_DIR.'/uploads/twitter_followers.xml', serialize($data)); } $dom = new DOMDocument; $s = simplexml_load_string($twitter_followers); $count = 0; echo '<ul class="seguidores">'; foreach($s->user as $follower): if(++$count > 50){ break; } echo '<li><a target="_blank" href="http://www.twitter.com/'.$follower->screen_name.'"><img width="32" height="32" src="'.$follower->profile_image_url.'" alt="'.$follower->name.'" title="'.$follower->name.': '.$follower->status->text.'"/></a></li>'; endforeach; echo '</ul>'; ?> |
Snippet Source/Credit: Snipplr