/ Published in: PHP
A simple script to show a followers list in Wordpress. (It can be used in other places also, you have to change the WP specific variables). The script needs to create a cache file to not overload Twitter API.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php //replace $options['twitter'] with the twitter Username you want to use. ?> <?php $xmlfollowersUrl = 'http://api.twitter.com/1/statuses/followers/'.$options['twitter'].'.xml'; $twitter_followers = $data['twitter_result']; } } if (!$twitter_followers) { // cache doesn't exist or is older than 10 mins } $dom = new DOMDocument; $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>'; ?>