For a client I needed to make an RSS feed with the latest item of three content types. The feed needed to contain three items: one for each of the three chosen content types.
I was first thinking about using views, to make a selection and then make a feed display. But it’s impossible to make union queries in views 2. I was able to make a display containing the three content types, limiting it to three items and sort the list on post date descending. But that didn’t guarantee me to have an item for each content type.
I started searching and came across .
This was the easiest solution. I made a small module, defined my own query (being a UNION ALL between three queries that got me the nid of the latest item for each content type). Then I fetched the nids and put them in an array. Next thing, I just used the API function . It generates an RSS feed containing the nodes from the nids you pass to it. The only thing you have to do to make it work is make an implementation of hook_menu make your feed available at a certain url. Sometimes it just can be this simple!