Recently, I added my Feedburner subscriber count to my sidebar on the right. Since I did this, I have had countless tweets and emails asking me, how I am able to display it as a number and not as one of the Feedburner chicklets.

Let me start this off by saying that you have to use Google’s Feedburner service for this to work. In order for this to work, I had to insert some PHP code that takes advantage of the Google Feedburner API. The code below needs to be inserted in one of your template file, I suggest the header.php template file.

<?php
$apiurl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=feedburnerid";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $apiurl);
$stored = curl_exec($ch);
curl_close($ch);
$grid = new SimpleXMLElement($stored);
$feedcount = $grid->feed->entry['circulation'];
?>

In the above code, you need to replace feedburnerid with your feed burner id. This id can be found at the end of your rss address. i.e. My RSS address is http://feeds.feedburner.com/atlchris so my feedburner id would be “atlchris.” Once you have done this, you just need to add one more line of PHP code.

<?php echo $feedcount; ?>

This code needs to be placed where you want the count to appear. You can wrap this code with a div or span tag, outside the PHP brackets, for styling. If you have any questions, please feel free to ask them in the comment section below.