官术网_书友最值得收藏!

Integrating Feedburner feeds on your theme

Feedburner is a service that allows you to keep a count of the people who have subscribed for your RSS feed. Once you have created a Feedburner feed, you have to integrate it to your theme. In this recipe, we shall learn three different How to do it... sections to integrate the Feedburner feeds with your theme.

Integrating Feedburner feeds on your theme

How to do it...

There are three methods of integrating the Feedburner with a theme. These methods have been explained in the following sections:

Let’s start with the manual way by carrying out the following steps:

  1. In order to integrate your Feedburner feeds, you can simply edit your theme files and replace the following line of code, <?php bloginfo('rss2_url'); ?> with your Feedburner URL.
  2. Usually, the RSS feeds are called in the header.php file. Many themes also feature RSS links in the footer.php and sidebar.php files.
  3. If you're using a Mac or a Linux machine, you can find any RSS link featured on a theme by executing the following command in the theme directory:
    find . -type f -print | xargs grep rss2_url

Thanks to open source, a WordPress plugin exists to help you with your Feedburner RSS feeds.

  1. This plugin that will help you with your Feedburner RSS is called FeedSmith and can be downloaded from the following link: http://blogs.feedburner.com/feedburner/archives/2007/10/the_feedsmith_plugin_newly_for.php
  2. Install and activate it, just like any other plugin.

How about a bit of WordPress hacking? It is easy to use the .htaccess file to automatically redirect any RSS feed top your Feedburner feed.

  1. The .htaccess file is located at the root of your WordPress installation. This is a configuration file for the Apache web server.
  2. While editing .htaccess, make sure to create a backup. If you make a mistake or typo in this file, your blog will stop functioning. However, if you create a backup, you can restore the backup file, in order to eliminate that problem.
  3. Edit the .htaccess file and add the following code (make sure you have replaced my Feedburner feed URL by yours!):
    <IfModule mod_rewrite.c>
     RewriteEngine on
     RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]
     RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
     RewriteRule ^feed/?([_0-9a-z-]+)?/?$ http://feeds.feedburner.com/wprecipes [R=302,NC,L]
    </IfModule>

How it works...

Let's have a look at the function of the preceding code:

  • First, we make sure that the mod_rewrite.c module is installed on the server. There's more than 90% of chance that it is installed, however, while developing you must keep in mind every rare possibility.
  • We need to make sure that the client user agent isn't the Feedburner itself, or the feed validator. We definitely don't want to redirect bots to our Feedburner feed URL, otherwise they'll be able to grab our new blog content!
  • Finally, we shall use a rewrite rule that requests the server redirect any kind of feed URL to our feedburner URL.
主站蜘蛛池模板: 仪征市| 贵德县| 镇宁| 东至县| 清流县| 苍山县| 盖州市| 通州市| 宁强县| 腾冲县| 云阳县| 宜城市| 苍南县| 崇仁县| 新巴尔虎左旗| 宁化县| 宁河县| 商洛市| 南乐县| 磐石市| 普定县| 喀喇沁旗| 南康市| 娄烦县| 龙州县| 朝阳县| 曲水县| 新河县| 莱芜市| 确山县| 浪卡子县| 林周县| 奇台县| 上栗县| 浏阳市| 武威市| 施甸县| 丰原市| 奈曼旗| 黄山市| 宜黄县|