Many bloggers are using Feedburner “chicklet” to display their subscribers count. If you want to be able to display the count for an average 7 days, here is a piece of code you’re going to love.
As usual, the first thing to do is to paste the function in your functions.php file:
function get_average_readers($feed_id,$interval = 7){
$today = date('Y-m-d', strtotime("now"));
$ago = date('Y-m-d', strtotime("-".$interval." days"));
$feed_url="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=".$feed_id."&dates=".$ago.",".$today;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $feed_url);
$data = curl_exec($ch);
curl_close($ch);
$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry['circulation'];
$nb = 0;
foreach($xml->feed->children() as $circ){
$nb += $circ['circulation'];
}
return round($nb/$interval);
}
Once done, you can call the function wherever you want in your theme files. Pass your Feedburner feed id as a parameter:
<?php
$nb = get_average_readers('catswhocode');
echo "I have ".$nb." RSS readers";
?>
Code initially published on Cats Who Blog.
Did you enjoy this article? Give us some link love, and don't forget to bookmark this page on Delicious.
Notes :
Join us and read the Guidelines to submit your guest posts.
Subscribe free updates via: RSS Feed | Email | Twitter
What Next?
- Tweet this Post
- Digg this Article
- Stumble this article
- Technorati this post
- Bookmark on del.icio.us






{ 13 comments… read them below or add one }
I think this would be perfect for a blog that has a decent subscriber count. I’ve only got about 16 so it probably would be embarrassing for me.
Lolz
) @Dean Saliba why you embarrassing . try get more Subscriber for yourself
Join one of the best online music clubs today! We offer free newsletters and more!
I’m never easy with codes but that was clean
Now that’s a neat bit of code. Many people are sure to find it interesting and very helpful. Thanks for sharing it.
Thanks for your comment. Hope you like this tips
Thanks for this, I was looking for this code to display on a custom theme. Average feed readers are imprtant to establish trust with your users
Happy this post can help you do that. Try it for your site now and you will happy ^^
Nice but, Feedburner is great way to do it
Thanks for the code, I was looking for this for some time to display feedburner on my blog. I saw it first on nettuts
Thanks for the code. ++reply
thanks for sharing this…;)