FeedBurner, Delicious and Twitter provided a way to showing you the several times the URL of the current page has actually appeared on their services. So the visitors assessed to your website can know How many people were Subscribed your feed url, how many people you have bookmarked your website url at Delicious or how many follower of your Twitter account …
Simple, their 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 subscriber count gives you a lot of control over styling and make the count work with your design. Therefore in this article we will share a way you can display FeedBurner subscriber, Twitter followers, Delicious saver count as text in WordPress (it also has the same effect in other blog, cms platform) which allows you can style it and make it look like a part of a design rather than a copy and paste.
Display your FeedBurner count in full text
Copy paste the following code into your template, replace feedburner-id with your FeedBuner username. This script will grab you the feed count in numbers.
[gist id=2886512]
To Display Feed Counter For Google FeedProxy In Text you can use the above code but you need to change this:
$fburl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=feedburner-id";
Into This:
$fburl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=feedburner-id";
You can surround it with the styling you like.
Get the number of Twitter follower in full text
When you have a website or blog and use Twitter, it is cool to display how many followers you have. To do so, simply use the short code snippet below.
<?php
$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name=catswhocode');
if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) {
$tw['count'] = $match[1];
}
echo $tw['count'];
?>
Replace twitter-id with your twitter username.
Show how many times your url has been added to Delicious
To make your count into plain text (for now and then you can do with it what ever you want) I’ll use small JavaScript and del.icio.us JSON feeds.
The HTML code
I was found <span id="delicious-count">0</span> reader who has been saved me to del.icio.us
The JavaScript
[gist id=2886515]
That’s it. It might look complicated, but it’s not. Just read it over slowly and let me know if you have any questions.
Hey Nguyen,
I especially like the JSON with del.icio.us bookmarks. Good stuff.
Thanks for code snippets, is there any way to show number of Facebook Fans?
I will republic this post with more snippets about Facebook then notice to you when done
Thanks for the code snippet.
but it does not work on my side, it shows an error “Fatal error: Uncaught exception ‘Exception’ with message ‘String could not be parsed as XML’ in /home/a5095664/public_html/feedburner-count.php:15 Stack trace: #0 /home/a5095664/public_html/feedburner-count.php(15): SimpleXMLElement->__construct(”) #1 {main} thrown in /home/a5095664/public_html/feedburner-count.php on line 15″
please help me to resolve this issue.
i have hosted my php page on 000webhosts which supports php 5.2.
You got Fatal error: because 000webhost not support
curl
function, that’s mean your script can’t load xml file from another webhost