As part of my summer holiday fun with WordPress I though I might create a ‘proper’ RSS feed for my microcast.
There are quite a few podcast plugins that would do the job but I though it might be interesting to try a bit of DIY.
Back when I started a class podcast at Radio Sandaig I used to create the RSS feed by hand with a text editor and a fair bit of copy and paste. Over at Edutalk we use feedburner to massage the feed for iTunes.
I used information from How to Roll Your Own Simple WordPress Podcast Plugin | CSS-Tricks to get me started with the template.
I copied the feed-rss2.php file from the wp-includes folder to my child theme folder renaming it feed-microcast.php
wp-content/themes/sempress-child/feed-microcast.php
I adjusted the query to get the posts from my microcast category. I also hard coded the title, link, image and a few other things to simplify the process a little.
I then used the template from CSS-Tricks as a guide to adding the various podcast tags to my template.
This ended up with a pretty broken feed, mostly due to my lack of care, but I fixed it up later I got it linked up.
I didn’t want to use the custom post type approach used in the article because that would involve editing all the old posts or converting them to the new type somehow.
My first idea was to create a feed template and switch to that when the RSS feed for my microcast category was called for.
After failing to get the template to switch for the standard category feed, /category/microcast/feed I ended up with a custom feed at /feed/microcast.
and I add
add_action('init', 'customRSS');
function customRSS(){
add_feed('microcast', 'customRSSFunc');
}
function customRSSFunc(){
get_template_part('feed', 'microcast');
}
to my functions.php file.
I then spent a bit of time using the W3C feed validation service until I fixed the feed up to valadate.
I’ve still got to get a link to the feed into the microcast category page head tag and I hope to do that as soon as I’ve gone a bit of research. For now I’ve a link in the sidebar.
Here is the template: WordPress RSS feed template for my microcast