在WordPress中显示Feedburner订阅数据
您可能已经看到将FeedBurner订阅者计数显示为文本的博客而不是恼人的小鸡。显示订阅者计数的功能使您可以对样式进行大量控制,并使计数与您的设计一致。因此,在本文中,我们将分享一种方式,您可以将FeedBurner订阅者计数显示为WordPress中的文本。
首先,您需要将此代码粘贴到您选择的模板文件中,例如您要显示文本的sidebar.php 。请务必更改FeedBurner ID。
<?php
//get cool feedburner count
$whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=your feedburner id";
//Initialize the Curl session
$ch = curl_init();
//Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Set the URL
curl_setopt($ch, CURLOPT_URL, $whaturl);
//Execute the fetch
$data = curl_exec($ch);
//Close the connection
curl_close($ch);
$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry["circulation"];
echo $fb;
//end get cool feedburner count
?>
你可以用你喜欢的样式包围它。