在WordPress中显示Feedburner订户计数为文本

您可能已经看到将FeedBurner订阅者计数显示为文本的博客而不是恼人的小鸡。显示订阅者计数的功能使您可以对样式进行大量控制,并使计数与您的设计一致。因此,在本文中,我们将分享一种方式,您可以将FeedBurner订阅者计数显示为WordPress中的文本。

首先,您需要将此代码粘贴到您选择的模板文件中,例如您要显示文本的sidebar.php 。请务必更改FeedBurner ID。这是你的网址后我们网站的名称wpbeginner。

    <?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      ?>

你可以用你喜欢的样式包围它。

您可能已经看到将FeedBurner订阅者计数显示为文本的博客而不是恼人的小鸡。显示订阅者计数的功能使您可以对样式进行大量控制,并使计数与您的设计一致。因此,在本文中,我们将分享一种方式,您可以将FeedBurner订阅者计数显示为WordPress中的文本。

首先,您需要将此代码粘贴到您选择的模板文件中,例如您要显示文本的sidebar.php 。请务必更改FeedBurner ID。这是你的网址后我们网站的名称wpbeginner。

    <?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      ?>

你可以用你喜欢的样式包围它。

相关推荐

发表回复

房先生
我们将24小时内回复。
2024-05-10 12:56:04
您好,有任何疑问请与我们联系!
您的工单我们已经收到,我们将会尽快跟您联系!
[QQ客服]
2781198
加我微信
[电话联系]
13585372227
[电子邮件]
chaoneo@163.com
取消

选择聊天工具: