Custom RSS Feed for a Podcast Category

I’ve started a podcast for my GlamourApprentice.com site. To make things easier I just made the podcasts their own category in WordPress and created a feed burner feed for that categories RSS2 feed.

The first episode went out and I subscribed to it in iTunes by entering the Feedburner RSS feed. And the name for the podcast was wrong. It was “Glamour Apprentice >> podcast.

The reason for this is the RSS2 template in WordPress uses the blog’s title, desciption and URL for the header information in all of its RSS feeds. I’m not positive this is the way to handle it if the feed is a category feed, but that’s the way it is.

Looking for a Solution.

I went looking for away to change this information for my category feed. I found this article on how to change the RSS title returned by hacking the feeds.php file in your WordPress installation.

That would work, but you have to remember to save your feeds.php files every upgrade. And since that can happen automatically, that’s a pain. You just shouldn’t change any file outside of the wp-content directory in WordPress.

The Solution

Now that I know where to look, I realized there were hooks to change these same routines without editing them directly. I’d hoped maybe I could just change things in my theme, but that didn’t seem to be possible. Plus the right solution would be theme independent.

The solution is to write a very simple Plugin. Which is what I did. Here’s the source:


< ?php
/**
 * @package Podcast Category RSS Name Changer
 * @author Ron Davis
 * @version 0.1
 */
/*
Plugin Name: Podcast Category RSS Name Changer
Plugin URI: http://www.glamourapprentice.com/
Description: Hack to change the name of my podcast category RSS to the name of the podcast
Author: Ron Davis
Version: 0.1
Author URI: http://www.glamourapprentice.com/
*/

function changeCat() {
     if (in_category('28')) { 
        echo 'The Shooting Beauty Model Photography Podcast'; 
     } else
     { 
     	echo get_wp_title_rss(); 
     } 
}

function changebloginfo_rss($result='', $show='') {
     if ( in_category('28') )
     {
 		switch ($show) {
			case 'name':
				$result = ''; 
				break;
			case 'url':
				$result = 'http://www.glamourapprentice.com/podcast';
				break;
			case 'description':
				$result = 'Engaging interviews with photographer and models discussion the art and collaboration.';
				break;
			default: 
        }
        return $result;
     } else
     { 
     	$result =  bloginfo_rss($show); 
     }
	return $result;
}

add_filter('wp_title_rss', 'changeCat', 1);
add_filter('bloginfo_rss', changebloginfo_rss, 1, 2);

?>

 

Warning: it is just a hack. It is very specific to my blog, and if you use it you are doing so at your own risk.

What I wanted to do was get rid of completely the blog title, and then instead of the category name, use the podcast’s title. While investigating I discovered it was using the blog’s description and URL, which I also wanted to change.

You need to know the category number. You can find this in your WP Dashboard under Posts->Categories. You enter that in the lines 17 and 26. My podcast’s category was 28. You could use the name of the category, but you might change that later and it would break the plugin.

On line 18, you enter the title of the podcast. This will replace the BlogName >> CategoryName default.

Then you would replace the information name, url, and description with your values.

Upload the text file with a name like “podcatchanger.php” into your plugins directory on your site, then activate the plugin in your Dashboard.

That should be it. Your RSS feed should have the correct information in it now.

This could be made more generic, maybe given an interface, but I don’t have time for that.

Star Trek is Awesome

Went to Star Trek last night and I have to say it was really, really good. The first 5 minutes is a whole movie in and of itself. I’m going to avoid spoilers, but I have to say some cool stuff.

The characters are all themselves reinterpreted by new actors. They are all a lot smarter, this is most obvious with Uhura, who is now a specialist in linguistics. Really she reminded me more of Hoshi on Enterprise as far as her job went. She’s also much more central to the plot.

Scotty is another example of a character smarter and more interesting. A lot of the interestingness of the new characters comes from their back story. Those back stories always pay tribute to TOS.

The production design was great. The look of the Enterprise interiors was very cool in places and industrial in others.

It did seem Star Fleet itself was a little less perfect than in previous episodes. The 4 on one fight scene was a little distrubing for Star Fleet cadets.

Ultimately the story was all about Spock and Kirk.

And they did something totally amazing that I can’t talk about. Arg!