How To Display Twitter counter in Text

February 11th, 2010 By WP Tricks Posted in Tips

Display Twitter Counter in Text is easily in WordPress with PHP code, all need to do just write down some PHP Script in our wordpress theme, we can write it on sidebar.php, footer.php, header.php or whatever we want to put on.

This code is similar with our previous tutorial about display FeedBurner counter in text, but we need to change some code, because the source is different, we still use file_get_contents() functions, this functions is the some function that we use to modified TimThumb Script to make it work on some server problem. So, let’s get started

Sponsored Links

Write down Display Twitter Counter in Text code below

<?php
$twit = file_get_contents('http://twitter.com/users/show/USERNAME.xml');
$begin = '<followers_count>'; $end = '</followers_count>';
$page = $twit;
$parts = explode($begin,$page);
$page = $parts[1];
$parts = explode($end,$page);
$tcount = $parts[0];
if($tcount == '') { $tcount = '0'; }
echo '<div class="twitter-badge"><strong>'.$tcount.' </strong> Followers</div>';

?>

Replace USERNAME with your own USERNAME, example our Twitter username is @WPTricksNet (you can follow it if you want ;)

That’s all, save your code and test it… I hope tutorial display Twitter Counter in Text work like charms just like our FeedBurner Counter in Text tricks too. Thanks for Webm.ag for share, via ThemeGamag Don’t forget to subscribe our RSS

How To Display Twitter counter in Text On The NET

How To Display Twitter counter in Text # WordPress Tricks & Tips

Display Twitter Counter in Text is easily in WordPress with PHP code, all need to do just write down some PHP Script in our wordpress theme, we can write it on read more

Source: http://wptricks.net/how-to-display-twitter-counter-in-text/

Display plan text counter of FeedBurner, Delicious and Twitter ...

Feedburner, Delicious and Twitter counter buttons are ugly. They don’t match with all the designs, and on most designs they just look ugly. The ability to display the ... read more

Source: http://www.narga.net/display-plan-text-counter-of-feedburner-delicious-and-twitter/

Text # WordPress Tricks & Tips

Display Twitter Counter in Text is easily in WordPress with PHP code, all need to do just write down some PHP Script in our wordpress theme, we can write it on sidebar.php, footer ... read more

Source: http://wptricks.net/tag/text/

Tricks: Display Total Twitter Followers as Text on WordPress ...

How To Display Twitter counter in Text # WordPress Tricks & Tips. How To Display Twitter counter in Text # WordPress Tricks & Tips. How To Display Total FeedBurner Reader in Text ... read more

Source: http://wptricks.net/tricks-display-total-twitter-followers-as-text-on-wordpress/

How To Display Twitter Follower Counts in Text | WpConstructs

Using Twitter Follower Counter from TwitterCount.com is bit too boring. With this ... 5 Responses to “How To Display Twitter Follower Counts in Text” read more

Source: http://wpconstructs.com/tutorials/how-to/how-to-display-twitter-follower-counts/


Amazing Touch


9 Comments

  1. I was searching google and other search engine and I found this solutions on this site… this is super tutorial..

    thanks for share

  2. Wonderful Twitter Tricks, I was try to find out this code for a while.. and we got it here

  3. Freelancer Witrer

    When will google buzz overtake twitter?

    • I think it’s will never happen.. Google Buzz it’s look like similar with Twitter… but it’s different…. Buzz is more thatn 140 Character… it’s Feed syndication from many many services included Twitter… ;)

  4. Great tip. Thanks for sharing

  5. Why not create a plugin for that? A lot of people are not familiar with php coding and how to run that code.

  6. Really nice tips.thanks for your help, man!
    Go on with it!

  7. Thanks, this is the only twitter code I’ve gotten to work. :)

  8. Hey guys, there is a simpler option that prints out the Twitter follower counter as plain text for WordPress blogs.

    I’ve developed a plugin that does that with an extra: you know how if Twitter is offline (fail whale) or it is slow, and how it impacts on your site, making it slow too?
    I’ve figured out a way to solve that by simply creating a cache. If Twitter is down, you still get your followers shown as it grabs the last known number of followers.
    Pretty neat, huh? Just check out the WordPress Plugin Directory for “Twitter Counter Cache-rizer”. Easy to install and works just fine!
    Here’s the link if you’re interrested:
    http://wordpress.org/extend/plugins/twitter-counter-cache-rizer/

    Hope it helps someone out!

    By the way, awesome blog design! I loved this wooden theme!


5 Trackbacks


Add Your Comment

Gravatar