How To Display The Average Number Of Your Subscribers

a minute read

Many bloggers use Feedburner to display the number of their subscribers. If you want to be able to show the average number of them over the past 7 days, here is the code that is useful for this purpose.
As usual, first of all you need to insert this function into the functions.php file of your theme:

1 function get_average_readers($feed_id,$interval = 7){
2     $today date('Y-m-d'strtotime("now"));
3     $ago date('Y-m-d'strtotime("-".$interval." days"));
4     $feed_url="".$feed_id."&dates=".$ago.",".$today;
5     $ch = curl_init();
6     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
7     curl_setopt($ch, CURLOPT_URL, $feed_url);
8     $data = curl_exec($ch);
9     curl_close($ch);
10     $xml new SimpleXMLElement($data);
11     $fb $xml->feed->entry['circulation'];
13     $nb = 0;
14     foreach($xml->feed->children() as $circ){
15         $nb += $circ['circulation'];
16     }
18     return round($nb/$interval);
19 }

Further, you can call this function anywhere on the site, but for this you need to specify id Feedburner as a parameter:

1 <?php
2 $nb = get_average_readers('wpincode');
3 echo "I have ".$nb." RSS subscribers";
4 ?>


Facebook Twitter LinkedIn Telegram Pocket

Related Posts:

Building and nurturing a mailing list is a crucial step in successful email marketing. Here are some key steps to follow:Define your target audience: Clearly identify your target audience to ensure your email campaigns are relevant and engaging to them. This w...
Have you ever had a need to bring your fresh posts from each separate column to your WordPress sidebar? Recently, one of our users asked us if there was a way to quickly bring up fresh posts from a specific category to the WordPress sidebar widget. In today’s ...
To fetch and display Facebook Page content on your website, you can follow these steps:Create a Facebook for Developers account: Go to the Facebook for Developers website ( and create an account using your Facebook credentials. If you d...