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 https://iface.wordpress.com/.
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:
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:
will remove the posts under wordpress global variables in this blog.
Techniques mentioned in Alphabetizing Posts can be used on the query, e.g.,
will result in the feed having alphabetically ordered posts.
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:
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.
Copyright Abhijit Nadgouda.