ifacethoughts

Ultimate WordPress RSS Feed Customization

Updated this post to reflect Matt’s comments and replace /wp-inst/wp-rss2.php by /feed/.

Just extending on Lorelle’s Customozing RSS Feed Links for WordPress.com and WordPress Sidebar Widgets which provides useful suggestions for customizing WordPress feeds, even for searches. Reading that article made me delve into more ways of syndicating specific content. Feed templates can also be modified for more granular control. If feeds are still Greek to you, Introduction to Syndication and WordPress Feeds will bring you up to speed.

Now, more customization for RSS feeds in WordPress! WordPress executes the WordPress Loop and the associated queries for producing the feeds. This implies that rules that apply for creating index, archive, searchor custom queries can be used for creating the feeds. It is kind of single-source publishing, same queries to be used for same content, irrespective of whether it displayed on the web or syndicated via the feed.

Let us see what this means for us. In addition to the default feeds, now we can provide additional partial feeds for posts created using WordPress queries, e.g., posts for last two days or order posts alphabetically or posts by a specific author in a multi-author blog. Say, one of your visitors is interested only in two categories and not all of them. Using this blog as an example, lets create a feed for categories blogging and wordpress.

All the examples given below are relative URLs with respect to the root of the blog, i.e., the URLs displayed below are appended to http://iface.wordpress.com/.

feed/?category_name=blogging
&category_name=wordpress

We have specified the category names as arguments to the file wp-rss2.php which produces the RSS feeds. If you are not afraid of handling IDs, the same result can be obtained using:

feed/?cat=91+33

Here, 91 is the category ID of the category blogging and 33 that of wordpress. This is so convenient for my reader who would otherwise had to subscribe to the entire feed and filter through the posts or subscribe to two feeds, one per category. This would be intolerable if the reader was interested in 10 categories out of 20.

Now consider a case where your visitor is interested in 9 out of 10 categories, that is you want to eliminate posts for one category from the feed. I am trying document all WordPress global variables on this blog, and all of them are filed under the wordpress global variables category. A reader, not interested in the WordPress plugins or theme development, might not interested in the wordpress global variables category posts. Here is how it can be done:

feed/?cat=-80413

will remove the posts under wordpress global variables in this blog.

Techniques mentioned in Alphabetizing Posts can be used on the query, e.g.,

feed/?cat=91+33&orderby=title&order=asc

will result in the feed having alphabetically ordered posts.

feed/?authorname=anadgouda

will produce a feed for posts by me, even if there were more authors writing on this blog.

If it is useful, feeds can also be produced for pages, following are multiple ways:

about/feed

feed/?pagename=about

feed/?page_id=2

While all the above examples can be used for a WordPress.com blog, they are applicable even to an independent blog. As a blog owner, you can probably create such feeds for specific readers of your blog.

WordPress gives you the ability to customize the RSS feeds by letting you run customized queries, this gives the ultimate power to the blog owner and the reader.

Technorati tags: , ,

Copyright Abhijit Nadgouda.

Discussion [Participate or Link]

  1. Matt said:

    Please don’t use wp-inst in any URLs, it could break at any time. You can use /feed/ URLs for all of your examples above.

  2. Abhijit Nadgouda said:

    Thanks for the clarification Matt, I will update the examples accordingly.

  3. links for 2006-04-19 | Shanta Rohse said:

    [...] Ultimate WordPress RSS Feed Customization I am always looking for ways to read less, not more. Abhijit Nadgouda’s primer for customizing RSS feeds explains how to provide customized partial feeds for posts by running customized queries. We’re one step closer to personalized content. (tags: RSS wordpress personalization guides) [...]

  4. Abhijit Nadgouda @ iface » Blog Archive » A Look At Movable Type v/s Wordpress said:

    [...] More customized syndication [...]

  5. Abhijit Nadgouda @ iface » Merging Blogs said:

    [...] If you feel that you don’t want to read about the programming posts, you can subscribe to this feed which does not include the posts under programming category. Head over here for more customization. [...]

  6. August said:

    Is there a parameter to limit the number of posts from a category? Let’s say I only want the 5 most recent posts from a category.

  7. Abhijit Nadgouda said:

    Hi August,

    WordPress lets you specify the number of posts in a feed in the admin area on Options -> Reading page under Syndication Feeds. This is retrieved from the database.

    It cannot be controlled through the query. Hope this helps.

  8. Feed Fatigue on iface thoughts said:

    [...] Seth Godin brings up problem of keeping up with bloggers (via Lorelle). This is one of the reasons I do not subscribe to a lot of team blogs and even professional bloggers. I have subscribed for some, but it is because quality is what stands out, not quantity. I want to read blogs for information, not information overload. Somedays the posts are many more, but if they are of the interest then the fatigue does not interfere. Fatigue is not a function of only the number of posts, but also of the interest in the posts. I have realised that subscribing to individuals has been better than subscribing to blogs where multiple authors churn out posts. I might be missing out on some of the top blogs, but I hardly miss any news! In fact I get a chance to skip the hyped up stuff easily because of this. Dave Winer, Doc Searls, Robert Scoble and Lorelle are only some of the individuals who offer more value than many of the team blogs out there. As for the team blogs, they can probably provide customizable feeds so that the reader can choose to subscribe to a subset. [...]

  9. WordPress Makes Sense For Many Non-Blog Websites | iface thoughts said:

    [...] by readers to keep themselves updated. WordPress generates feeds for both pages and posts and various other queries, which you can offer to your reader and customers. It is also quite popular that these feeds can be [...]

  10. WordPress feed filtering at WebGrrrl.net said:

    [...] feeds with query string My googling led me to ifacethought’s page on RSS feed customization, so I initially contemplated on changing my Feed URL by adding a query string to my RSS icon (see [...]

  11. WordPress 2.3 And Another Comparison With Movable Type | iface thoughts said:

    [...] also has some terrrific featuers, like flexible feed customization, which makes it easier to get a customized feed for yourself. The template heirarchy can be very [...]

  12. A Look At Movable Type v/s Wordpress | iface thoughts said:

    [...] far as I know, WordPress has the most customizable syndication available. Movable Type does support full and category based syndication, but still not as flexible [...]

  13. Melvin Ram said:

    The feed/?cat=91+33 approach doesn’t seem to work any more.

  14. WordPress Makes Sense As CMS For Many Non-Blog Websites | Blogging Insider said:

    [...] by readers to keep themselves updated. WordPress generates feeds for both pages and posts and various other queries, which you can offer to your reader and customers. It is also quite popular that these feeds can be [...]

  15. GolfScoreGenius said:

    Interesting content.
    You often come up with the best posts & Ultimate WordPress RSS Feed Customization |
    iface thoughts is absolutely no exception.

    my web page – GolfScoreGenius

  16. WordCamp Israel WordPress Tips Talk « Lorelle on WordPress said:

    [...] ifacethoughts – Ultimate WordPress RSS Feed Customization [...]

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
My bookmarks

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.