How To: Display Your Google Feedburner Feed Count In Your Wordpress Blog



FeedBurner-256x256 Feedburner were one of the first companies that delved heavily into RSS and the statistics they generate. By allowing blog owners to direct all their RSS feeds to one central account, the owners would be able to report on how their feeds are being used.

Feedburner were so good at what they did, they were acquired by Google. Recently, Google have enabled Feedburner users to migrate their accounts to tie in with their Google Accounts, meaning they were also able to integrate their feeds into the Adsense platform. With this change, some Wordpress plugins are unable to report on feeds that have been migrated across but with a small snippet of code I will show you how to embed your Feedburner feed count with having to use the eyesore that is the chicklet.

You can see this tutorial in action by looking to the WillINeedIt sidebar and checking out the Feedburner Subscriber Stats.

Step One

The first step is to identify where you wish your count to be displayed. On this side it is in the sidebar.php file.

We need to enter the code that calls the Feedburner API and gets your information. At a convenient space at the top of your file, enter the following code:

   1: <?php 
   2: $whaturl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=willineedit";  
   3: $ch = curl_init();  
   4: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
   5: curl_setopt($ch, CURLOPT_URL, $whaturl);  
   6: $data = curl_exec($ch);  
   7: curl_close($ch);  
   8: $xml = new SimpleXMLElement($data);  
   9: $fb = $xml->feed->entry['circulation'];  
  10: ?>


Step Two

The final part is to embed the command to display the count. Find the place you wish to display it and enter the following short snippet:

   1: <?php echo $fb; ?>


And that’s it. You can enter text before and after the count to make it look more appealing.

N.B

If you wish to display your count from a Feedburner account that hasn’t been migrated to Google, replace the code in Line 2 of the first code box on this page with the following code:

   1: $whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=feedburner-id"; 

Once you have embedded your count, the next thing to do is style it. I will leave that part up to you!

Blog Widget by LinkWithin
blog comments powered by Disqus

Search

Subscribe and Enjoy!

   

    

Signup to receive our free daily newsletter:

  


Alltop. We're kind of a big deal.

Connect With Us





Featured On WillINeedIt

Have you had your service, product or website reviewed on WillINeedIt? Why not embed a shiny new badge?!