Returns your Twitter Followers Count. Reduces the Twitter API calls by updating hourly and serving a database cached result in between.
Author: | Derek Herman (profile at wordpress.org) |
WordPress version required: | 2.7 |
WordPress version tested: | 3.0.5 |
Plugin version: | 1.0 |
Added to WordPress repository: | 08-12-2010 |
Last updated: | 06-12-2010
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
Rating, %: | 87 |
Rated by: | 6 |
Plugin URI: | http://wordpress.org/extend/plugins/followers... |
Total downloads: | 1 067 |
Click to start download |
Returns a database stored Twitter Followers Count in plain text or number format. Reduces the Twitter API calls by only updating the followers count hourly and serving a database cached result in between.
You can use the function <?php followers_count( $id, $default, $echo, $format ); ?>
in your theme files. The following is an explanation of the parameters the function excepts.
- @param array $ids an array of Twitter IDs
- @param int $default your fallback followers count during a zero result: default 0
- @param bool $echo return or echo: default true (echo)
- @param bool $format return as plain integer or number formatted: default true (number format)
For example, if I was Psdtuts+ and wanted to echo out a followers count that had a fallback or default followers count in the unlikely event nothing is stored in the database or there is a weird zero result returned, I would do the follow.
<?php followers_count( 'envatographics', 15000 ); ?>
If I wanted to save the count to a variable as a plain integer that I could add to another count or something similar I would do this.
<?php $followers_count = followers_count( 'envatographics', 15000, false, false ); ?>
If I wanted to echo a formatted count form an array of $ids with a fallback, I would do this.
<?php followers_count( array( 'envatographics', 'nettuts' ), 15000 ); ?>