How can I add an iTunes tag to my RSS feeds within podpress for each individual category feed?
There is possibility to add such a tags with podPress.
Currently I have not enough time implement such an options.
But if you are not afraid of editing e.g. the functions.php of your theme then you may add something like this:
/* This function adds the podtrac namespace in all RSS2 feeds of a blog. */
add_action('rss2_ns', 'podtrac_rss2_ns');
function podtrac_rss2_ns() {
echo 'xmlns:podtrac="http://www.podtrac.com/player2.0/tips.php#rss"'."\n";
}
/* This function adds podtrac RSS tags to certain category feeds (RSS2 feeds). */
add_action('rss2_head', 'podtrac_rss2_head');
function podtrac_rss2_head() {
Global $wp_query;
if ( is_category() ) {
$cat_id='';
// If it is a category feed then try to retrieve the ID or the slug name of the category.
if ( FALSE === empty($wp_query->query_vars['cat']) OR FALSE === empty($wp_query->query_vars['tag']) OR FALSE === empty($wp_query->query_vars['category_name']) ) {
if ( FALSE === empty($wp_query->query_vars['category_name']) ) {
$cat_id = $wp_query->query_vars['category_name'];
} elseif ( FALSE === empty($wp_query->query_vars['tag']) ) {
$cat_id = $wp_query->query_vars['tag'];
} elseif ( FALSE === empty($wp_query->query_vars['cat']) ) {
$cat_id = $wp_query->query_vars['cat'];
}
}
// If it is a category feed and an ID or the slug name exists, add the tags related to this category feed.
Switch ($cat_id) {
case 'mobile-learning' : // insert the name or the ID of the category here
echo "\t".'<podtrac:itunespodcastid>987654321</podtrac:itunespodcastid>'."\n";
break;
case 'mp3' :
echo "\t".'<podtrac:itunespodcastid>123456789</podtrac:itunespodcastid>'."\n";
break;
// ......
}
}
}
This is probably not as comfortable as a form on a settings page but you can edit this file via the Admin site (Appearance > Editor > Theme Functions (functions.php)) of your blog.
Insert e.g. instead of mp3 or mobile-learning the names or IDs of the categories you want to. Maybe copy and paste the 3 lines
case '...' :
echo "\t".'<podtrac:itunespodcastid>...</podtrac:itunespodcastid>'."\n";
break;
You may also add different Podtrac RSS tags with this sheme:
case '...' :
echo "\t".'<podtrac:itunespodcastid>...</podtrac:itunespodcastid>'."\n";
echo "\t".'<podtrac:...>...</podtrac:...>'."\n";
break;
The more I think about the whole issue the more I ask myself why Podtrac does not write a nice little plugin which does something like that. They know there API and documentation better then anyone else. Furthermore is it not in their business interests to offer such a plugin to the large group of WP users?
Anyway, If you have questions about the code snippet above then please ask.
Tim