While tweaking down this theme, I wanted to use my subscriber count in plain text. Actually, it wasn’t that hard thanks to 45n5’s great tutorial in doing that. Not to mention, the dozens of other articles which pointed the exact same thing following that particular tutorial.
Anyway, all of them were from the time before Google started intergrating Feedburner into their own setting and because of that, the code was a bit outdated and gave a php error.
parser error : Opening and ending tag mismatch: meta line 1 and HEAD
And when I looked into the problem, I understod that it was because Feedburner specifications had changed around since the Google Integration. So, I worked around it and found the solution.
So here’s how to get the feed count in plain text.
In whatever place you want the feed count, insert these lines, possibly at the very top of the page (Don’t forget to replace myFeedburnerFeedId with the ID of your feed)
<?php
$whaturl=”https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=myFeedburnerFeedId”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $whaturl);
$data = curl_exec($ch);
curl_close($ch);$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry['circulation'];?>
Then, in the place where you want the feedcount to appear, just insert:
<?php echo $fb;?>
And we’re done!
You can see on the top-right of this blog, it’s at work. Have fun with it guys!